about summary refs log tree commit diff stats
path: root/app/views/quotes/voted.js.erb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-21 00:25:50 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-21 00:25:50 -0400
commit96813a5e508a54257ef03be613a704f1f71af53d (patch)
treea50f5c8dc27304a3ca27366b6268a72804727e16 /app/views/quotes/voted.js.erb
parent2a7a19c93ee0e0d77e4e388d43f36a721c7ab715 (diff)
downloadthoughts-96813a5e508a54257ef03be613a704f1f71af53d.tar.gz
thoughts-96813a5e508a54257ef03be613a704f1f71af53d.tar.bz2
thoughts-96813a5e508a54257ef03be613a704f1f71af53d.zip
Added quotes database
Diffstat (limited to 'app/views/quotes/voted.js.erb')
-rw-r--r--app/views/quotes/voted.js.erb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/views/quotes/voted.js.erb b/app/views/quotes/voted.js.erb new file mode 100644 index 0000000..c697c7d --- /dev/null +++ b/app/views/quotes/voted.js.erb
@@ -0,0 +1,12 @@
1$("#quote-rating-<%= @quote.id %>").html('<%= escape_javascript("+#{@quote.upvotes}/-#{@quote.downvotes}") %>');
2
3<% if @quote.already_upvoted? request.remote_ip %>
4 $("#quote-upvote-link-<%= @quote.id %>").html("Up");
5<% elsif @quote.already_downvoted? request.remote_ip %>
6 $("#quote-downvote-link-<%= @quote.id %>").html("Down");
7<% else %>
8 $("#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)) %>');
9 $("#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)) %>');
10<% end %>
11
12$("#quote-header-<%= @quote.id %>").effect('highlight', {}, 2000);