<% # Clients of this partial must provide the following variable: # comment %> <% if comment.can_be_voted_on? %> <% can_vote = comment.can_be_voted_on_by?(@commontator) %> <% vote = comment.votes.find_by_voter_id_and_voter_type(@commontator.id, @commontator.class.name) %> <% if can_vote && (vote.blank? || !vote.vote_flag) %> <%= form_tag upvote_comment_path(comment), :method => :put, :remote => true do %> <%= image_submit_tag "commontator/upvote.png", :onmouseover => "this.src='/assets/commontator/upvote_hover.png'", :onmouseout => "this.src='/assets/commontator/upvote.png'" %> <% end %> <% elsif can_vote %> <%= form_tag unvote_comment_path(comment), :method => :put, :remote => true do %> <%= image_submit_tag "commontator/upvote_hover.png", :onmouseover => "this.src='/assets/commontator/upvote.png'", :onmouseout => "this.src='/assets/commontator/upvote_hover.png'" %> <% end %> <% else %> <%= image_tag "commontator/upvote_hover.png" %> <% end %> <%= comment.upvotes.size %>
<% if can_vote && (vote.blank? || vote.vote_flag) %> <%= form_tag downvote_comment_path(comment), :method => :put, :remote => true do %> <%= image_submit_tag "commontator/downvote.png", :onmouseover => "this.src='/assets/commontator/downvote_hover.png'", :onmouseout => "this.src='/assets/commontator/downvote.png'" %> <% end %> <% elsif can_vote %> <%= form_tag unvote_comment_path(comment), :method => :put, :remote => true do %> <%= image_submit_tag "commontator/downvote_hover.png", :onmouseover => "this.src='/assets/commontator/downvote.png'", :onmouseout => "this.src='/assets/commontator/downvote_hover.png'" %> <% end %> <% else %> <%= image_tag "commontator/downvote_hover.png" %> <% end %> <%= comment.downvotes.size %> <% end %>