Class: Decidim::Debates::DebateCardMetadataCell
- Inherits:
-
CardMetadataCell
- Object
- CardMetadataCell
- Decidim::Debates::DebateCardMetadataCell
- Includes:
- ActionView::Helpers::DateHelper, LayoutHelper
- Defined in:
- app/cells/decidim/debates/debate_card_metadata_cell.rb
Overview
This cell renders metadata for an instance of a Meeting
Instance Method Summary collapse
- #category_item ⇒ Object
- #debate_items ⇒ Object
- #duration ⇒ Object
-
#initialize ⇒ DebateCardMetadataCell
constructor
A new instance of DebateCardMetadataCell.
Constructor Details
#initialize ⇒ DebateCardMetadataCell
Returns a new instance of DebateCardMetadataCell.
14 15 16 17 18 |
# File 'app/cells/decidim/debates/debate_card_metadata_cell.rb', line 14 def initialize(*) super @items.prepend(*debate_items) end |
Instance Method Details
#category_item ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/cells/decidim/debates/debate_card_metadata_cell.rb', line 20 def category_item return if category.blank? { text: category.translated_name, icon: resource_type_icon_key("Decidim::Category") } end |
#debate_items ⇒ Object
29 30 31 |
# File 'app/cells/decidim/debates/debate_card_metadata_cell.rb', line 29 def debate_items [duration, comments_count_item, endorsements_count_item, category_item, ] end |
#duration ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/cells/decidim/debates/debate_card_metadata_cell.rb', line 33 def duration text = format_date_range(debate.start_time, debate.end_time) || t("open", scope: "decidim.debates.debates.show") { text:, icon: "time-line" } end |