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
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

View File

@@ -73,7 +73,7 @@
</li>
<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>
</ul>
</li>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -378,7 +378,16 @@ en:
form:
submit_button: Save changes
polls:
all: "All"
no_dates: "no date assigned"
dates: "From %{open_at} to %{closed_at}"
index:
filters:
current: "Open"
incoming: "Incoming"
expired: "Expired"
show:
dates_title: "Participation dates"
cant_answer_not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in
signup: Sign up
@@ -390,31 +399,18 @@ en:
poll_questions:
create_question: "Create question"
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:
original_proposal: "Original proposal"
author: "Created by"
dates_title: "Participation dates"
dates: "From %{open_at} to %{closed_at}"
external_url: "Additional documentation"
more_info: "More information"
not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in
signup: Sign up
cant_answer_verify_html: "You must %{verify_link} in order to answer."
verify_link: "verify your account"
cant_answer_incoming: "This question has not yet started."
cant_answer_expired: "This question has finished."
cant_answer_incoming: "This poll has not yet started."
cant_answer_expired: "This poll has finished."
cant_answer_wrong_geozone: "This question is not available on your geozone."
vote_answer: "Vote %{answer}"
voted: "You have voted %{answer}"

View File

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