Sha256: 2ced91ad9c8d2d371d4c39551929a2602e9e002c83cbac3cca102a5dd3ee145d
Contents?: true
Size: 755 Bytes
Versions: 1
Compression:
Stored size: 755 Bytes
Contents
module Helpers def seems_rateable_style stylesheet_link_tag "rateable/jRating.jquery" end def rating_for(obj, opts={:dimension => nil, :static => false}) begin kls = opts[:dimension].nil? ? obj.average : obj.average(opts[:dimension]) avg = kls ? kls.avg : 0 content_tag :div, "", "data-average" => avg, :class => "rateable#{opts[:static] ? " jDisabled" : nil}#{current_user ? nil : " jDisabled"}", "data-id" => obj.id, "data-kls" => obj.class.name, "data-dimension" => opts[:dimension]#, "data-size" => "small" rescue StandardError => error eval "raise 'Rateable object #{obj.inspect} does not exist'" end end end class ActionView::Base include Helpers end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seems_rateable-1.0.2 | lib/seems_rateable/helpers.rb |