Class: Decidim::Accountability::ResultHistoryCell

Inherits:
ResourceHistoryCell
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/cells/decidim/accountability/result_history_cell.rb

Overview

This cell is used to render a result history panel of a resource inside a tab of a show view

The ‘model` must be an accountability result resource to get the history from.

Example:

cell(
  "decidim/result_history",
  result
)

Instance Method Summary collapse

Methods included from ApplicationHelper

#apply_accountability_pack_tags, #component_name, #display_percentage

Instance Method Details

#creation_itemObject



43
44
45
46
47
48
49
50
# File 'app/cells/decidim/accountability/result_history_cell.rb', line 43

def creation_item
  {
    id: "result_creation",
    date: @model.created_at,
    text: t("decidim.accountability.creation.text"),
    icon: resource_type_icon_key("Decidim::Accountability::Result")
  }
end

#history_cell_idObject



52
53
54
# File 'app/cells/decidim/accountability/result_history_cell.rb', line 52

def history_cell_id
  "result"
end

#linked_resources_itemsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/cells/decidim/accountability/result_history_cell.rb', line 19

def linked_resources_items
  [
    {
      resources: @model.linked_resources(:proposals, "included_proposals"),

      link_name: "included_proposals",
      text_key: "decidim.accountability.result.proposal_ids",
      icon_key: "Decidim::Proposals::Proposal"
    },
    {
      resources: @model.linked_resources(:projects, "included_projects"),
      link_name: "included_projects",
      text_key: "decidim.accountability.result.project_ids",
      icon_key: "Decidim::Budgets::Project"
    },
    {
      resources: @model.linked_resources(:meetings, "meetings_through_proposals"),
      link_name: "meetings_through_proposals",
      text_key: "decidim.accountability.result.meetings_ids",
      icon_key: "Decidim::Meetings::Meeting"
    }
  ]
end