Module: Decidim::ResourceReferenceHelper

Defined in:
app/helpers/decidim/resource_reference_helper.rb

Overview

Helper to print resource references.

Instance Method Summary collapse

Instance Method Details

#resource_reference(resource, options = {}) ⇒ Object

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.



13
14
15
16
17
# File 'app/helpers/decidim/resource_reference_helper.rb', line 13

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