Sha256: b86e1c1cf62c711ee6cf164d7ad309026965b9a925b31c691daef3f62f631c39

Contents?: true

Size: 741 Bytes

Versions: 4

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helper to print Feature references.
  module FeatureReferenceHelper
    # Displays the localized reference for the given feature.
    #
    # feature - the Feature that has the reference to display.
    # options - An optional hash of options
    #         * class: A string of extra css classes
    #
    # Returns a String.
    def feature_reference(feature, options = {})
      return unless feature.reference
      @reference = feature.reference
      "<div class='tech-info #{options[:class]}'>#{localized_reference}</div>".html_safe
    end

    private

    def localized_reference
      I18n.t("reference", reference: @reference, scope: "decidim.shared.reference")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.9.3 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.9.2 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.9.1 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.9.0 app/helpers/decidim/feature_reference_helper.rb