Merge pull request #150 from AyuntamientoMadrid/votes

Avoid voting by not logged users
This commit is contained in:
Enrique García
2015-08-12 10:15:06 +02:00
7 changed files with 63 additions and 2 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

@@ -11,10 +11,11 @@
// - - - - - - - - - - - - - - - - - - - - - - - - -
@mixin votes {
border-top: 1px solid $votes-border;
padding: rem-calc(14) rem-calc(12);
background: $votes-bg;
border-top: 1px solid $votes-border;
margin: 0 -12px;
padding: rem-calc(14) rem-calc(12);
position: relative;
.icon-like {
background: white;
@@ -114,6 +115,24 @@
.divider {
margin: 0 rem-calc(6);
}
.not-logged {
background: $not-logged-bg;
color: white;
height: 100%;
left: 0;
line-height: $line-height*2;
padding-top: $line-height/2;
position: absolute;
text-align: center;
top: 0;
width: 100%;
a {
color: white;
text-decoration: underline;
}
}
}
// 02. Index
@@ -291,6 +310,11 @@
line-height: $line-height/2;
}
}
.not-logged {
line-height: $line-height;
padding-top: $line-height*1.5;
}
}
}
@@ -378,6 +402,11 @@
float: none;
line-height: $line-height;
}
.not-logged {
line-height: $line-height;
padding: $line-height;
}
}
.leave-comment {

View File

@@ -47,6 +47,8 @@ $votes-text: #FFFFFF;
$votes-unlike: #EF8585;
$votes-unlike-act: #BD6A6A;
$not-logged-bg: rgba(22,99,135,.9);
// 03. Forms
// - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@@ -20,4 +20,12 @@
<span class="total-votes">
<%= pluralize(debate.total_votes, t("debates.debate.vote"), t("debates.debate.votes")) %>
</span>
<% 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>

View File

@@ -61,6 +61,9 @@ en:
agree: I agree
disagree: I disagree
supports: Supports
unauthenticated: "You need to %{signin} or %{signup} before continuing."
signin: sign in
signup: sign up
account:
show:
title: "My account"

View File

@@ -61,6 +61,9 @@ es:
agree: Estoy de acuerdo
disagree: No estoy de acuerdo
supports: Apoyos
unauthenticated: "Necesitas %{signin} o %{signup} para continuar."
signin: iniciar sesión
signup: registrarte
account:
show:
title: "Mi cuenta"