shows not-logged votes on hover if user not logged

Fixes #85
This commit is contained in:
Juanjo Bazán
2015-08-11 23:20:42 +02:00
parent 3cddc1070a
commit 0541e9e936
3 changed files with 20 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
var initialize_modules = function() {
App.Comments.initialize();
App.Votes.initialize();
};
$(function(){

View File

@@ -0,0 +1,15 @@
App.Votes =
hoverize: (votes) ->
$(votes).hover ->
$("div.not-logged", votes).show()
, ->
$("div.not-logged", votes).hide()
initialize: ->
App.Votes.hoverize votes for votes in $("div.votes")
false

View File

@@ -20,9 +20,12 @@
<span class="total-votes">
<%= pluralize(debate.total_votes, t("debates.debate.vote"), t("debates.debate.votes")) %>
</span>
<div class="not-logged">
<% unless user_signed_in? %>
<div class="not-logged" style='display:none'>
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
</div>