mysociety/alaveteli

View on GitHub
app/helpers/admin/citations_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Helpers for displaying Citations in the admin interface
module Admin::CitationsHelper
  ICONS = {
    journalism: '🗞️',
    campaigning: '📣',
    academic: '🎓',
    other: '🌐'
  }.with_indifferent_access.freeze

  def citation_icon(citation)
    html_attrs = {
      title: citation.type.humanize,
      class: "citation-icon citation-icon--#{citation.type}"
    }

    tag.span(ICONS.fetch(citation.type), **html_attrs)
  end
end