refactors i18n for polls

This commit is contained in:
Juanjo Bazán
2016-12-07 14:49:56 +01:00
parent 6aa96c4471
commit 1a20a3ce46
13 changed files with 71 additions and 43 deletions

View File

@@ -9,7 +9,15 @@ module PollsHelper
end end
def all_polls def all_polls
["Todas", admin_questions_path] [I18n.t("polls.all"), admin_questions_path]
end
def poll_dates(poll)
if poll.starts_at.blank? || poll.ends_at.blank?
I18n.t("polls.no_dates")
else
I18n.t("polls.dates", open_at: l(poll.starts_at.to_date), closed_at: l(poll.ends_at.to_date))
end
end end
end end

View File

@@ -73,7 +73,7 @@
</li> </li>
<li <%= 'class=active' if controller_name == 'booths' %>> <li <%= 'class=active' if controller_name == 'booths' %>>
<%= link_to t('admin.menu.booths'), admin_booths_path %> <%= link_to t('admin.menu.poll_booths'), admin_booths_path %>
</li> </li>
</ul> </ul>
</li> </li>

View File

@@ -1,11 +1,13 @@
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<% if @poll.questions.empty? %> <% if @poll.questions.empty? %>
<div class="callout primary text-center"> <div class="callout primary text-center">
<%= t('admin.polls.show.no_questions') %> <%= t('admin.polls.show.no_questions') %>
</div> </div>
<% else %> <% else %>
<h2><%= t("admin.polls.show.questions_title") %></h2>
<table> <table>
<% @poll.questions.each do |question| %> <% @poll.questions.each do |question| %>
<tr id="<%= dom_id(question) %>"> <tr id="<%= dom_id(question) %>">

View File

@@ -2,7 +2,7 @@
<%= form_tag '', method: :get do %> <%= form_tag '', method: :get do %>
<%= select_tag "poll_id", <%= select_tag "poll_id",
poll_select_options(true), poll_select_options(true),
prompt: t("admin.booths.index.select_poll"), prompt: t("admin.questions.index.select_poll"),
class: "js-location-changer" %> class: "js-location-changer" %>
<% end %> <% end %>
</div> </div>

View File

@@ -10,7 +10,7 @@
<div class="small-12 medium-6"> <div class="small-12 medium-6">
<%= f.select :poll_id, <%= f.select :poll_id,
options_for_select(Poll.pluck(:name, :id)), options_for_select(Poll.pluck(:name, :id)),
prompt: t("admin.booths.index.select_poll") %> prompt: t("admin.questions.index.select_poll") %>
</div> </div>
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %> <%= f.text_field :title, maxlength: Poll::Question.title_max_length %>

View File

@@ -1,7 +1,7 @@
<%= render 'shared/filter_subnav', i18n_namespace: "polls.index" %> <%= render 'shared/filter_subnav', i18n_namespace: "polls.index" %>
<% @polls.each do |poll| %> <% @polls.each do |poll| %>
<%= link_to poll.name, poll %> <%= link_to poll.name, poll %> (<%= poll_dates(poll) %>)
<% end %> <% end %>
<%= paginate @polls %> <%= paginate @polls %>

View File

@@ -7,7 +7,7 @@
<% if @question.proposal.present? %> <% if @question.proposal.present? %>
<div class="margin-bottom"> <div class="margin-bottom">
<%= link_to t('questions.show.original_proposal'), @question.proposal %> <%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>
</div> </div>
<% end %> <% end %>
@@ -22,28 +22,36 @@
<div class="small-12 medium-3 column info"> <div class="small-12 medium-3 column info">
<p> <p>
<span class="title author"><%= t('questions.show.author') %></span><br> <span class="title author"><%= t('poll_questions.show.author') %></span><br>
<%= link_to @question.author.name, @question.author %> <%= link_to @question.author.name, @question.author %>
</p> </p>
<p> <p>
<span class="title url"><%= t('questions.show.external_url') %></span><br> <span class="title"><%= t('poll_questions.show.dates_title') %></span><br>
<%# link_to @question.external_url, @question.external_url %> <span class="date"><%= poll_dates(@question.poll) %></span>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<% if @question.poll.current? %>
<div class="row margin-top text-center" id="<%= dom_id(@question) %>_answers"> <div class="row margin-top text-center" id="<%= dom_id(@question) %>_answers">
<%= render "answers", question: @question %> <%= render "answers", question: @question %>
</div> </div>
<% elsif @question.poll.incoming? %>
<%= t('poll_questions.show.cant_answer_expired') %>
<% elsif @question.poll.expired? %>
<%= t('poll_questions.show.cant_answer_incoming') %>
<% end %>
<div class="row margin-top"> <div class="row margin-top">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<h3><%= t('questions.show.more_info') %></h3> <h3><%= t('poll_questions.show.more_info') %></h3>
<%= @question.description %> <%= @question.description %>
</div> </div>
</div> </div>
<%= render "comments" %> <%= render "comments" %>

View File

@@ -1,4 +1,5 @@
<%= @poll.name %> <h1><%= @poll.name %></h1>
<p><strong><%= t("polls.show.dates_title") %>: <%= poll_dates(@poll) %></strong></p>
<% unless can?(:answer, @poll) %> <% unless can?(:answer, @poll) %>
<div class="small-12 column"> <div class="small-12 column">

View File

@@ -131,6 +131,7 @@ ignore_unused:
- 'moderation.debates.index.order*' - 'moderation.debates.index.order*'
- 'valuation.spending_proposals.index.filter*' - 'valuation.spending_proposals.index.filter*'
- 'users.show.filters.*' - 'users.show.filters.*'
- 'polls.index.filters.*'
- 'debates.index.select_order' - 'debates.index.select_order'
- 'debates.index.orders.*' - 'debates.index.orders.*'
- 'debates.index.search_form.*' - 'debates.index.search_form.*'

View File

@@ -106,6 +106,7 @@ en:
valuators: Valuators valuators: Valuators
poll_officers: Poll officers poll_officers: Poll officers
polls: Polls polls: Polls
poll_booths: Booths
officials: Officials officials: Officials
organizations: Organisations organizations: Organisations
settings: Configuration settings settings: Configuration settings
@@ -181,9 +182,10 @@ en:
no_booths: "There are no booths in this poll." no_booths: "There are no booths in this poll."
no_questions: "There are no questions assigned to this poll yet." no_questions: "There are no questions assigned to this poll yet."
no_officers: "There are no officers assigned to this poll." no_officers: "There are no officers assigned to this poll."
add_booth: "Add booth"
remove_booth: "Remove booth from poll" remove_booth: "Remove booth from poll"
booths_title: "List of booths" booths_title: "List of booths"
officers_title: "List of officers"
questions_title: "List of questions"
name: "Name" name: "Name"
location: "Location" location: "Location"
email: "Email" email: "Email"
@@ -191,7 +193,8 @@ en:
index: index:
title: "Questions" title: "Questions"
create: "Create question" create: "Create question"
no_enquiries: "There are no questions." no_questions: "There are no questions."
select_poll: Select Poll
edit: edit:
title: "Edit Question" title: "Edit Question"
new: new:

View File

@@ -106,6 +106,7 @@ es:
valuators: Evaluadores valuators: Evaluadores
poll_officers: Presidentes de mesa poll_officers: Presidentes de mesa
polls: Votaciones polls: Votaciones
poll_booths: Urnas
officials: Cargos públicos officials: Cargos públicos
organizations: Organizaciones organizations: Organizaciones
settings: Configuración global settings: Configuración global
@@ -181,9 +182,10 @@ es:
no_booths: "No hay urnas en esta votación." no_booths: "No hay urnas en esta votación."
no_questions: "No hay preguntas asignadas a esta votación todavía." no_questions: "No hay preguntas asignadas a esta votación todavía."
no_officers: "No hay presidentes de mesa asignados." no_officers: "No hay presidentes de mesa asignados."
add_booth: "Añadir urna"
remove_booth: "Deasignar urna" remove_booth: "Deasignar urna"
booths_title: "Listado de urnas" booths_title: "Listado de urnas"
officers_title: "Listado de presidentes de mesa"
questions_title: "Listado de preguntas"
name: "Nombre" name: "Nombre"
location: "Ubicación" location: "Ubicación"
email: "Email" email: "Email"
@@ -191,7 +193,8 @@ es:
index: index:
title: "Preguntas ciudadanas" title: "Preguntas ciudadanas"
create: "Crear pregunta ciudadana" create: "Crear pregunta ciudadana"
no_enquiries: "No hay ninguna pregunta ciudadana." no_questions: "No hay ninguna pregunta ciudadana."
select_poll: Seleccionar votación
edit: edit:
title: "Editar pregunta ciudadana" title: "Editar pregunta ciudadana"
new: new:

View File

@@ -378,7 +378,16 @@ en:
form: form:
submit_button: Save changes submit_button: Save changes
polls: polls:
all: "All"
no_dates: "no date assigned"
dates: "From %{open_at} to %{closed_at}"
index:
filters:
current: "Open"
incoming: "Incoming"
expired: "Expired"
show: show:
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."
signin: Sign in signin: Sign in
signup: Sign up signup: Sign up
@@ -390,31 +399,18 @@ en:
poll_questions: poll_questions:
create_question: "Create question" create_question: "Create question"
default_valid_answers: "Yes, No" default_valid_answers: "Yes, No"
index:
filters:
opened: "Open"
incoming: "Incoming"
expired: "Expired"
title: "Enquiries"
description_html: "The following citizen proposals that have reached the <strong>required supports</strong> and will be voted."
dates: "From %{open_at} to %{closed_at}"
no_enquiries_opened: "There aren't opened enquiries."
no_enquiries_expired: "There aren't expired enquiries."
no_enquiries_incoming: "There aren't incoming enquiries."
show: show:
original_proposal: "Original proposal" original_proposal: "Original proposal"
author: "Created by" author: "Created by"
dates_title: "Participation dates" dates_title: "Participation dates"
dates: "From %{open_at} to %{closed_at}"
external_url: "Additional documentation"
more_info: "More information" more_info: "More information"
not_logged_in: "You must %{signin} or %{signup} to participate." not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in signin: Sign in
signup: Sign up signup: Sign up
cant_answer_verify_html: "You must %{verify_link} in order to answer." cant_answer_verify_html: "You must %{verify_link} in order to answer."
verify_link: "verify your account" verify_link: "verify your account"
cant_answer_incoming: "This question has not yet started." cant_answer_incoming: "This poll has not yet started."
cant_answer_expired: "This question has finished." cant_answer_expired: "This poll has finished."
cant_answer_wrong_geozone: "This question is not available on your geozone." cant_answer_wrong_geozone: "This question is not available on your geozone."
vote_answer: "Vote %{answer}" vote_answer: "Vote %{answer}"
voted: "You have voted %{answer}" voted: "You have voted %{answer}"

View File

@@ -377,26 +377,32 @@ es:
update: update:
form: form:
submit_button: Guardar cambios submit_button: Guardar cambios
poll_questions: polls:
create_question: "Crear votación" all: "Todas"
default_valid_answers: "Sí, No" no_dates: "sin fecha asignada"
dates: "Desde el %{open_at} hasta el %{closed_at}"
index: index:
filters: filters:
opened: "Abiertas" current: "Abiertas"
incoming: "Próximamente" incoming: "Próximamente"
expired: "Terminadas" expired: "Terminadas"
title: "Votaciones" show:
description_html: "Las siguientes propuestas ciudadanas han alcanzado el <strong>número de apoyos necesarios</strong> y pasarán a votación." dates_title: "Fechas de participación"
dates: "Desde el %{open_at} hasta el %{closed_at}" cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar."
no_enquiries_opened: "No hay votaciones abiertas." signin: iniciar sesión
no_enquiries_expired: "No hay votaciones terminadas." signup: registrarte
no_enquiries_incoming: "No hay votaciones próximamente." cant_answer_verify_html: "Por favor %{verify_link} para poder responder."
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."
poll_questions:
create_question: "Crear pregunta para votación"
default_valid_answers: "Sí, No"
show: show:
original_proposal: "Propuesta original" original_proposal: "Propuesta original"
author: "Creado por" author: "Creado por"
dates_title: "Fechas de participación" dates_title: "Fechas de participación"
dates: "Desde el %{open_at} hasta el %{closed_at}"
external_url: "Documentación adicional"
more_info: "Más información" more_info: "Más información"
not_logged_in: "Necesitas %{signin} o %{signup} para participar." not_logged_in: "Necesitas %{signin} o %{signup} para participar."
signin: iniciar sesión signin: iniciar sesión