Sha256: a1973acd78ca04192404c2c89c59319edf3ce9d1bf3dc6398d85bbbb806e5db7

Contents?: true

Size: 611 Bytes

Versions: 4

Compression:

Stored size: 611 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.
    #
    # Returns a String.
    def feature_reference(feature)
      return unless feature.reference
      @reference = feature.reference
      "<div class='reference'>#{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.3.2 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.3.1 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.3.0 app/helpers/decidim/feature_reference_helper.rb
decidim-core-0.2.0 app/helpers/decidim/feature_reference_helper.rb