diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index def844e5a..d6dedd05c 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -21,6 +21,7 @@ var initialize_modules = function() { App.Comments.initialize(); + App.Votes.initialize(); }; $(function(){ diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee new file mode 100644 index 000000000..5005ad5b8 --- /dev/null +++ b/app/assets/javascripts/votes.js.coffee @@ -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 + + + + diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss index 3d59bf618..be1005f74 100644 --- a/app/assets/stylesheets/debates.scss +++ b/app/assets/stylesheets/debates.scss @@ -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 { diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss index 74f0f2bfb..03ea93dfd 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/variables.scss @@ -47,6 +47,8 @@ $votes-text: #FFFFFF; $votes-unlike: #EF8585; $votes-unlike-act: #BD6A6A; +$not-logged-bg: rgba(22,99,135,.9); + // 03. Forms // - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb index 7f47e2649..a15a66a4d 100644 --- a/app/views/debates/_votes.html.erb +++ b/app/views/debates/_votes.html.erb @@ -20,4 +20,12 @@ <%= pluralize(debate.total_votes, t("debates.debate.vote"), t("debates.debate.votes")) %> + + <% unless user_signed_in? %> + + <% end %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index d5bf38506..2451745c9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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" diff --git a/config/locales/es.yml b/config/locales/es.yml index f11259370..da7fe8303 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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"