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

Version Path
sufia-5.0.0 app/helpers/trophy_helper.rb
sufia-5.0.0.rc1 app/helpers/trophy_helper.rb
sufia-6.0.0.rc2 app/helpers/trophy_helper.rb
sufia-6.0.0.rc1 app/helpers/trophy_helper.rb
sufia-4.3.1 app/helpers/trophy_helper.rb
sufia-6.0.0.beta1 app/helpers/trophy_helper.rb
sufia-4.2.0 app/helpers/trophy_helper.rb
sufia-4.1.0 app/helpers/trophy_helper.rb
sufia-4.0.1 app/helpers/trophy_helper.rb
sufia-4.0.0 app/helpers/trophy_helper.rb
sufia-4.0.0.rc2 app/helpers/trophy_helper.rb
sufia-4.0.0.rc1 app/helpers/trophy_helper.rb
sufia-4.0.0.beta4 app/helpers/trophy_helper.rb
sufia-4.0.0.beta3 app/helpers/trophy_helper.rb
sufia-4.0.0.beta2 app/helpers/trophy_helper.rb
sufia-4.0.0.beta1 app/helpers/trophy_helper.rb