Sha256: 416d0155934e19b023780f41f6aa9e5ae8f71da1f8e113433570214a8bfdc77b
Contents?: true
Size: 727 Bytes
Versions: 16
Compression:
Stored size: 727 Bytes
Contents
# -*- coding: utf-8 -*- module TrophyHelper def display_trophy_link(user, noid, args={}, &block) trophy = user.trophies.where(generic_file_id: noid).first trophyclass = trophy ? "trophy-on" : "trophy-off" args[:add_text] ||= "Highlight File on Profile" args[:remove_text] ||= "Unhighlight File" 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] = sufia.trophy_profile_path(user, file_id: noid) link_to '#', class: args[:class], data: args[:data] do yield(text) end end end
Version data entries
16 entries across 16 versions & 1 rubygems