Module: Decidim::ParticipatoryProcessHelper
- Defined in:
- app/helpers/decidim/participatory_process_helper.rb
Overview
Helpers related to the Participatory Process layout.
Instance Method Summary collapse
-
#feature_icon(feature) ⇒ Object
Public: Returns an icon given an instance of a Feature.
-
#participatory_process_step_dates(participatory_process_step) ⇒ Object
Public: Returns the dates for a step in a readable format like “2016-01-01 - 2016-02-05”.
Instance Method Details
#feature_icon(feature) ⇒ Object
Public: Returns an icon given an instance of a Feature. It defaults to a question mark when no icon is found.
feature - The feature to generate the icon for.
Returns an HTML tag with the icon.
22 23 24 25 26 27 28 |
# File 'app/helpers/decidim/participatory_process_helper.rb', line 22 def feature_icon(feature) if feature.manifest.icon external_icon feature.manifest.icon else icon "question-mark" end end |
#participatory_process_step_dates(participatory_process_step) ⇒ Object
Public: Returns the dates for a step in a readable format like “2016-01-01 - 2016-02-05”.
participatory_process_step - The step to format to
Returns a String with the formatted dates.
11 12 13 14 |
# File 'app/helpers/decidim/participatory_process_helper.rb', line 11 def participatory_process_step_dates(participatory_process_step) dates = [participatory_process_step.start_date, participatory_process_step.end_date] dates.map { |date| date ? localize(date.to_date, format: :default) : "?" }.join(" - ") end |