Module: Decidim::ParticipatoryProcesses::ParticipatoryProcessHelper
- Includes:
- AttachmentsHelper, FiltersHelper, IconHelper, ResourceReferenceHelper, SanitizeHelper, WidgetUrlsHelper
- Defined in:
- app/helpers/decidim/participatory_processes/participatory_process_helper.rb
Overview
Helpers related to the Participatory Process layout.
Instance Method Summary collapse
-
#participatory_process_cta_path(process) ⇒ Object
Public: Returns the path for the participatory process cta button.
-
#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
#participatory_process_cta_path(process) ⇒ Object
Public: Returns the path for the participatory process cta button
Returns a String with path.
28 29 30 31 32 33 34 |
# File 'app/helpers/decidim/participatory_processes/participatory_process_helper.rb', line 28 def participatory_process_cta_path(process) return participatory_process_path(process) if process.active_step&.cta_path.blank? path, params = participatory_process_path(process).split("?") "#{path}/#{process.active_step.cta_path}" + (params.present? ? "?#{params}" : "") end |
#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.
20 21 22 23 |
# File 'app/helpers/decidim/participatory_processes/participatory_process_helper.rb', line 20 def 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 |