Sha256: 4cd151fcfc88f221d5ba69a8722dd82c3b6b8c29fa9b2eb354c552cf658743d5
Contents?: true
Size: 787 Bytes
Versions: 26
Compression:
Stored size: 787 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, options = {}) return unless resource.respond_to?(:reference) && resource.reference.present? "<div class='tech-info #{options[:class]}'>#{localized_reference(resource.reference)}</div>".html_safe end private def localized_reference(reference) I18n.t("reference", reference: reference, scope: "decidim.shared.reference") end end end
Version data entries
26 entries across 26 versions & 1 rubygems