Class: Decidim::ResourceHistoryCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::ResourceHistoryCell
- Defined in:
- app/cells/decidim/resource_history_cell.rb
Instance Method Summary collapse
-
#creation_item ⇒ Object
return the creation item to show in the history, it will be added only if there are linked resources.
-
#history_cell_id ⇒ Object
return an unique id to identify the type of history cell.
- #history_items ⇒ Object
-
#linked_resources_items ⇒ Object
return an array of linked resources to show in the history.
- #render? ⇒ Boolean
- #show ⇒ Object
Instance Method Details
#creation_item ⇒ Object
return the creation item to show in the history, it will be added only if there are linked resources
33 34 35 |
# File 'app/cells/decidim/resource_history_cell.rb', line 33 def creation_item raise NotImplementedError end |
#history_cell_id ⇒ Object
return an unique id to identify the type of history cell
23 24 25 |
# File 'app/cells/decidim/resource_history_cell.rb', line 23 def history_cell_id raise NotImplementedError end |
#history_items ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/cells/decidim/resource_history_cell.rb', line 9 def history_items return @history_items if @history_items.present? @history_items = [] linked_resources_items.each do |item| add_linked_resources_items(item[:resources], item) end @history_items << creation_item if @history_items.any? @history_items.sort_by! { |item| item[:date] } end |
#linked_resources_items ⇒ Object
return an array of linked resources to show in the history
28 29 30 |
# File 'app/cells/decidim/resource_history_cell.rb', line 28 def linked_resources_items raise NotImplementedError end |
#render? ⇒ Boolean
37 38 39 |
# File 'app/cells/decidim/resource_history_cell.rb', line 37 def render? linked_resources_items.any? { |item| item[:resources].present? } end |
#show ⇒ Object
5 6 7 |
# File 'app/cells/decidim/resource_history_cell.rb', line 5 def show render end |