Sha256: 695ff87b890ac8b42d01dc573b2e0666633887a5a7dac9d9f9e5c5ff40d24bad

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    # Simple helper to handle markup variations for participatory texts related partials
    module ParticipatoryTextsHelper
      # 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.
      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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-proposals-0.16.1 app/helpers/decidim/proposals/participatory_texts_helper.rb
decidim-proposals-0.16.0 app/helpers/decidim/proposals/participatory_texts_helper.rb