Class: Decidim::CollapsibleAuthorsCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::CollapsibleAuthorsCell
- Defined in:
- app/cells/decidim/collapsible_authors_cell.rb
Overview
This cell renders a collapsible list of authors. Each element from the
array of Users will be rendered with the :cell cell.
Constant Summary collapse
- MAX_ITEMS_STACKED =
3
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
9 10 11 12 13 14 |
# File 'app/cells/decidim/collapsible_authors_cell.rb', line 9 def show return cell("decidim/author", model.first, .merge()) if model.length == 1 return render :stack if [:stack] render end |
#single_author_options ⇒ Object
16 17 18 |
# File 'app/cells/decidim/collapsible_authors_cell.rb', line 16 def [:stack] ? { skip_profile_link: true } : { layout: :compact } end |
#visible_authors ⇒ Object
20 21 22 |
# File 'app/cells/decidim/collapsible_authors_cell.rb', line 20 def @visible_authors ||= model.take(MAX_ITEMS_STACKED) end |