Sha256: fcf2ed54352bb91ec097255fa13e7cc98b54e53b5a2c18bb4132f9d878655f78

Contents?: true

Size: 701 Bytes

Versions: 13

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helper to print resource references.
  module ResourceReferenceHelper
    # Displays the localized reference for the given resource.
    #
    # resource - the Resource that has the reference to display.
    # options - An optional hash of options
    #         * class: A string of extra css classes
    #
    # Returns a String.
    def resource_reference(resource)
      return unless resource.respond_to?(:reference) && resource.reference.present?

      localized_reference(resource.reference)
    end

    private

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.4 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.29.0 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.3 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.29.0.rc4 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.29.0.rc3 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.29.0.rc2 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.29.0.rc1 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.2 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.1 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.0 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.0.rc5 app/helpers/decidim/resource_reference_helper.rb
decidim-core-0.28.0.rc4 app/helpers/decidim/resource_reference_helper.rb