Class: Adminable::EntriesPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- Adminable::EntriesPresenter
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/adminable/presenters/entries_presenter.rb
Constant Summary collapse
- ENTRIES_LIMIT =
5
Instance Method Summary collapse
-
#initialize(relation) ⇒ EntriesPresenter
constructor
A new instance of EntriesPresenter.
- #to_s ⇒ Object
Constructor Details
#initialize(relation) ⇒ EntriesPresenter
22 23 24 25 26 27 |
# File 'lib/adminable/presenters/entries_presenter.rb', line 22 def initialize(relation) @relation = relation @collection = relation.all.map do |entry| Adminable::EntryPresenter.new(entry) end end |
Instance Method Details
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/adminable/presenters/entries_presenter.rb', line 29 def to_s string = collection.first(ENTRIES_LIMIT).map do |entry| view.link_to(entry.to_name, edit_polymorphic_path(entry)) end string << and_more_tag if collection_size_residue > 0 string.join(', ').html_safe end |