separates answerable questions and moves callout to a partial
This commit is contained in:
22
app/views/polls/_callout.html.erb
Normal file
22
app/views/polls/_callout.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<% unless can?(:answer, @poll) %>
|
||||
<% if current_user.nil? %>
|
||||
<div class="callout primary">
|
||||
<%= t("polls.show.cant_answer_not_logged_in",
|
||||
signin: link_to(t("polls.show.signin"), new_user_session_path, class: "probe-message"),
|
||||
signup: link_to(t("polls.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %>
|
||||
</div>
|
||||
<% elsif current_user.unverified? %>
|
||||
<div class="callout warning">
|
||||
<%= t('polls.show.cant_answer_verify_html',
|
||||
verify_link: link_to(t('polls.show.verify_link'), verification_path)) %>
|
||||
</div>
|
||||
<% elsif @poll.incoming? %>
|
||||
<div class="callout primary">
|
||||
<%= t('polls.show.cant_answer_incoming') %>
|
||||
</div>
|
||||
<% elsif @poll.expired? %>
|
||||
<div class="callout alert">
|
||||
<%= t('polls.show.cant_answer_expired') %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -3,60 +3,52 @@
|
||||
|
||||
<div class="expanded no-margin-top dark-heading poll-show">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column padding">
|
||||
<div class="small-12 medium-9 column padding">
|
||||
<%= render "shared/back_link" %>
|
||||
|
||||
<h2><%= @poll.name %></h2>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column padding info">
|
||||
<p class="title">
|
||||
<strong><%= t("polls.show.dates_title") %></strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong><%= poll_dates(@poll) %></strong>
|
||||
<%= t("polls.show.question_count_html",
|
||||
count: @poll.questions.count) %>
|
||||
</p>
|
||||
|
||||
<%= render "callout" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<div class="info">
|
||||
<p>
|
||||
<span class="title">
|
||||
<strong><%= t("polls.show.dates_title") %></strong>
|
||||
</span>
|
||||
<br>
|
||||
<%= poll_dates(@poll) %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 column">
|
||||
<% unless can?(:answer, @poll) %>
|
||||
<% if current_user.nil? %>
|
||||
<div class="callout primary">
|
||||
<%= t("polls.show.cant_answer_not_logged_in",
|
||||
signin: link_to(t("polls.show.signin"), new_user_session_path, class: "probe-message"),
|
||||
signup: link_to(t("polls.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %>
|
||||
</div>
|
||||
<% elsif current_user.unverified? %>
|
||||
<div class="callout warning">
|
||||
<%= t('polls.show.cant_answer_verify_html',
|
||||
verify_link: link_to(t('polls.show.verify_link'), verification_path)) %>
|
||||
</div>
|
||||
<% elsif @poll.incoming? %>
|
||||
<div class="callout primary">
|
||||
<%= t('polls.show.cant_answer_incoming') %>
|
||||
</div>
|
||||
<% elsif @poll.expired? %>
|
||||
<div class="callout alert">
|
||||
<%= t('polls.show.cant_answer_expired') %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<% @answerable_questions.each do |question| %>
|
||||
<%= render 'polls/questions/question', question: question %>
|
||||
<% end %>
|
||||
|
||||
<% if can?(:answer, @poll) &&
|
||||
@non_answerable_questions.present? %>
|
||||
<div class="callout warning">
|
||||
<%= t('polls.show.cant_answer_wrong_geozone') %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% @non_answerable_questions.each do |question| %>
|
||||
<%= render 'polls/questions/question', question: question %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if can?(:answer, @poll) && @non_answerable_questions.present? %>
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 medium-9 column">
|
||||
<div class="callout warning">
|
||||
<h2 class="questions-callout">
|
||||
<%= t("polls.show.cant_answer_wrong_geozone",
|
||||
count: @non_answerable_questions.count) %>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<% @non_answerable_questions.each do |question| %>
|
||||
<%= render 'polls/questions/question', question: question %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -398,7 +398,8 @@ en:
|
||||
verify_link: "verify your account"
|
||||
cant_answer_incoming: "This poll has not yet started."
|
||||
cant_answer_expired: "This poll has finished."
|
||||
cant_answer_wrong_geozone: "The following questions are not available in your geozone."
|
||||
cant_answer_wrong_geozone: "You can't answers the following %{count} questions because are not available in your geozone."
|
||||
question_count_html: "This poll has a total of <strong>%{count} qeustions</strong>."
|
||||
poll_questions:
|
||||
create_question: "Create question"
|
||||
default_valid_answers: "Yes, No"
|
||||
@@ -417,6 +418,7 @@ en:
|
||||
cant_answer_wrong_geozone: "This question is not available on your geozone."
|
||||
vote_answer: "Vote %{answer}"
|
||||
voted: "You have voted %{answer}"
|
||||
poll: "Poll"
|
||||
banner:
|
||||
featured_title: "#NextVoting"
|
||||
info: "New proposals that have reached the voting phase."
|
||||
|
||||
@@ -398,7 +398,8 @@ es:
|
||||
verify_link: "verifica tu cuenta"
|
||||
cant_answer_incoming: "Esta votación todavía no ha comenzado."
|
||||
cant_answer_expired: "Esta votación ha terminado."
|
||||
cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona."
|
||||
cant_answer_wrong_geozone: "No puedes responder a las siguientes %{count} preguntas porque no están disponibles en tu zona:"
|
||||
question_count_html: "Esta votación tiene un total de <strong>%{count} preguntas</strong>."
|
||||
poll_questions:
|
||||
create_question: "Crear pregunta para votación"
|
||||
default_valid_answers: "Sí, No"
|
||||
@@ -417,6 +418,7 @@ es:
|
||||
cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona."
|
||||
vote_answer: "Votar %{answer}"
|
||||
voted: "Has votado %{answer}"
|
||||
poll: "Votación"
|
||||
banner:
|
||||
featured_title: "#PróximaVotación"
|
||||
info: "Nuevas propuestas ciudadanas han llegado a la fase de votación."
|
||||
|
||||
Reference in New Issue
Block a user