Sha256: 2fa4fc235c77a32102a2c8355249b350cde556ae575b475c87b1d5c2b49898f0
Contents?: true
Size: 876 Bytes
Versions: 9
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true module Hyrax module TrophyHelper def display_trophy_link(user, id, args = {}, &_block) return unless user trophy = user.trophies.where(work_id: id).exists? trophyclass = trophy ? "trophy-on" : "trophy-off" args[:add_text] ||= t("hyrax.dashboard.my.action.highlight") args[:remove_text] ||= t("hyrax.dashboard.my.action.unhighlight") text = trophy ? args[:remove_text] : args[:add_text] args[:class] = [args[:class], "trophy-class #{trophyclass}"].compact.join(' ') args[:data] ||= {} args[:data]['add-text'] = args[:add_text] args[:data]['remove-text'] = args[:remove_text] args[:data][:url] = hyrax.trophy_work_path(id) link_to '#', class: args[:class], data: args[:data] do yield(text) end end # rubocop:enable Metrics/MethodLength end end
Version data entries
9 entries across 9 versions & 1 rubygems