Module: Decidim::Proposals::ParticipatoryTextsHelper

Defined in:
app/helpers/decidim/proposals/participatory_texts_helper.rb

Overview

Simple helper to handle markup variations for participatory texts related partials

Instance Method Summary collapse

Instance Method Details

#preview_participatory_text_section_title(proposal) ⇒ Object

Returns the title for a given participatory text section.

proposal - The current proposal item.

Returns a string with the title of the section, subsection or article.



12
13
14
15
# File 'app/helpers/decidim/proposals/participatory_texts_helper.rb', line 12

def preview_participatory_text_section_title(proposal)
  translated = t(proposal.participatory_text_level, scope: "decidim.proposals.admin.participatory_texts.sections", title: proposal.title)
  translated.html_safe
end

#render_participatory_text_title(participatory_text) ⇒ Object



17
18
19
20
21
22
23
# File 'app/helpers/decidim/proposals/participatory_texts_helper.rb', line 17

def render_participatory_text_title(participatory_text)
  if participatory_text.nil?
    t("alternative_title", scope: "decidim.proposals.participatory_text_proposal")
  else
    translated_attribute(participatory_text.title)
  end
end