adds icon if already answer poll

This commit is contained in:
Alberto Garcia Cabeza
2017-02-03 17:43:44 +01:00
parent 54472852ca
commit 46d9961c36
4 changed files with 29 additions and 9 deletions

View File

@@ -1382,6 +1382,7 @@ ul.ballot-list {
&.can-answer:after, &.can-answer:after,
&.cant-answer:after, &.cant-answer:after,
&.not-logged-in:after, &.not-logged-in:after,
&.already-answer:after,
&.unverified:after { &.unverified:after {
font-family: "icons" !important; font-family: "icons" !important;
left: 34px; left: 34px;
@@ -1390,20 +1391,20 @@ ul.ballot-list {
} }
&.can-answer { &.can-answer {
border-right: 60px solid $success-bg; border-right: 60px solid $info-bg;
&:after { &:after {
color: $color-success; color: $color-info;
content: "\59"; content: "\6c";
} }
} }
&.cant-answer { &.cant-answer {
border-right: 60px solid $warning-bg; border-right: 60px solid $alert-bg;
&:after { &:after {
color: $color-warning; color: $color-alert;
content: "\76"; content: "\74";
} }
} }
@@ -1424,6 +1425,15 @@ ul.ballot-list {
content: "\6f"; content: "\6f";
} }
} }
&.already-answer {
border-right: 60px solid $success-bg;
&:after {
color: $color-success;
content: "\59";
}
}
} }
.dates { .dates {

View File

@@ -1,9 +1,13 @@
<% poll_group.each do |poll| %> <% poll_group.each do |poll| %>
<div class="poll"> <div class="poll">
<% if poll.answerable_by?(current_user) && poll.votable_by?(current_user) %> <% if poll.answerable_by?(current_user) && poll.votable_by?(current_user) %>
<div class="icon-poll-answer can-answer" title="<%= t("polls.index.can_answer") %>"> <%= link_to poll,
<span class="sr-only"><%= t("polls.index.can_answer") %></span> class: "icon-poll-answer can-answer",
</div> title: t("polls.index.can_answer") do %>
<span class="sr-only">
<%= t("polls.index.can_answer") %>
</span>
<% end %>
<% elsif current_user.nil? %> <% elsif current_user.nil? %>
<%= link_to new_user_session_path, <%= link_to new_user_session_path,
class: "icon-poll-answer not-logged-in", class: "icon-poll-answer not-logged-in",
@@ -20,6 +24,10 @@
<%= t("polls.index.cant_answer_verify") %> <%= t("polls.index.cant_answer_verify") %>
</span> </span>
<% end %> <% end %>
<% elsif !poll.votable_by?(current_user) %>
<div class="icon-poll-answer already-answer" title="<%= t("polls.index.already_answer") %>">
<span class="sr-only"><%= t("polls.index.already_answer") %></span>
</div>
<% else %> <% else %>
<div class="icon-poll-answer cant-answer" title="<%= t("polls.index.cant_answer") %>"> <div class="icon-poll-answer cant-answer" title="<%= t("polls.index.cant_answer") %>">
<span class="sr-only"><%= t("polls.index.cant_answer") %></span> <span class="sr-only"><%= t("polls.index.cant_answer") %></span>

View File

@@ -410,6 +410,7 @@ en:
cant_answer: "This poll is not available on your geozone" cant_answer: "This poll is not available on your geozone"
cant_answer_not_logged_in: "You must sign in or sign up to participate" cant_answer_not_logged_in: "You must sign in or sign up to participate"
cant_answer_verify: "You must verify your account in order to answer" cant_answer_verify: "You must verify your account in order to answer"
already_answer: "You already have participated in this poll"
show: show:
dates_title: "Participation dates" dates_title: "Participation dates"
cant_answer_not_logged_in: "You must %{signin} or %{signup} to participate." cant_answer_not_logged_in: "You must %{signin} or %{signup} to participate."

View File

@@ -410,6 +410,7 @@ es:
cant_answer: "Esta votación no está disponible en tu zona" cant_answer: "Esta votación no está disponible en tu zona"
cant_answer_not_logged_in: "Necesitas iniciar sesión o registrarte para participar" cant_answer_not_logged_in: "Necesitas iniciar sesión o registrarte para participar"
cant_answer_verify: "Por favor verifica tu cuenta para poder responder" cant_answer_verify: "Por favor verifica tu cuenta para poder responder"
already_answer: "Ya has participado en esta votación"
show: show:
dates_title: "Fechas de participación" dates_title: "Fechas de participación"
cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar." cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar."