about summary refs log tree commit diff stats
path: root/app/views/quotes/voted.js.erb
blob: c697c7da4ec5ddbf5985917581645b312410bfe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
$("#quote-rating-<%= @quote.id %>").html('<%= escape_javascript("+#{@quote.upvotes}/-#{@quote.downvotes}") %>');

<% if @quote.already_upvoted? request.remote_ip %>
  $("#quote-upvote-link-<%= @quote.id %>").html("Up");
<% elsif @quote.already_downvoted? request.remote_ip %>
  $("#quote-downvote-link-<%= @quote.id %>").html("Down");
<% else %>
  $("#quote-upvote-link-<%= @quote.id %>").html('<%= escape_javascript(link_to("Up", upvote_quote_path(@quote.id), :remote => true, :rel => "nofollow", :class => "quote-upvote-link", method: :post)) %>');
  $("#quote-downvote-link-<%= @quote.id %>").html('<%= escape_javascript(link_to("Down", downvote_quote_path(@quote.id), :remote => true, :rel => "nofollow", :class => "quote-downvote-link", method: :post)) %>');
<% end %>

$("#quote-header-<%= @quote.id %>").effect('highlight', {}, 2000);