Sha256: 2f6294fd6dcedb52eacd3098776246605508c6025f23bd3bb60237feb2f17d85

Contents?: true

Size: 880 Bytes

Versions: 10

Compression:

Stored size: 880 Bytes

Contents

# -*- encoding : utf-8 -*-
module LoyalCore
  module Ajax
    module LikeTracksHelper
      def loyal_core_helper_ajax_liker_link_to target, options={}
        link_to  "javascript:;", {
          'march-on' => 'ajax',
          'march-type' => 'march-type',
          'march-id' => target.uuid,
          'march-action' => 'like'
        }.merge(options) do
          html = ""
          html << (
            image_tag image_path("loyal_core/liked.gif"), :class => 'liked', :style => "display: #{target.liked_by?(current_user) ? 'inline' : 'none'};"
          )

          html << (
            image_tag image_path("loyal_core/unlike.gif"), :class => 'unlike', :style => "display: #{target.liked_by?(current_user) ? 'none' : 'inline'};"
          )
          html << "<span class='count'>#{target.liked_count}</span>"
          raw html
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
loyal_core-0.0.11 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.10 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.8 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.7 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.6 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.5 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.4 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.3 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.2 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb
loyal_core-0.0.1 lib/loyal_core/action_helper/ajax/like_tracks_helper.rb