From 0a3acf3c5fe8b2eaaea616a373453ca73f9f19e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 3 Dec 2020 15:44:12 +0100 Subject: [PATCH] Use a shared translation for search buttons We were writing the same text over and over for the same translations. Since they all serve the same function, it's perfectly fine for them to have the same text, and so we can have a shared translation. --- app/components/admin/search_component.html.erb | 2 +- .../admin/local_census_records/index.html.erb | 2 +- app/views/admin/organizations/index.html.erb | 2 +- app/views/admin/organizations/search.html.erb | 2 +- .../poll/booth_assignments/_search_booths.html.erb | 2 +- .../officer_assignments/_search_officers.html.erb | 2 +- app/views/admin/poll/officers/_search.html.erb | 2 +- app/views/admin/poll/questions/_search.html.erb | 2 +- app/views/admin/shared/_booth_search.html.erb | 2 +- app/views/admin/shared/_debate_search.html.erb | 2 +- app/views/admin/shared/_proposal_search.html.erb | 2 +- app/views/admin/users/index.html.erb | 2 +- app/views/moderation/users/index.html.erb | 2 +- config/locales/en/admin.yml | 12 ++---------- config/locales/en/moderation.yml | 1 - config/locales/es/admin.yml | 14 +++----------- config/locales/es/moderation.yml | 1 - 17 files changed, 18 insertions(+), 36 deletions(-) diff --git a/app/components/admin/search_component.html.erb b/app/components/admin/search_component.html.erb index 117a9b50f..911f742d2 100644 --- a/app/components/admin/search_component.html.erb +++ b/app/components/admin/search_component.html.erb @@ -1,4 +1,4 @@ <%= form_tag(url, method: :get, role: "search") do |f| %> <%= text_field_tag :search, search_terms.to_s, placeholder: label, "aria-label": label %> - <%= submit_tag t("admin.shared.user_search.button") %> + <%= submit_tag t("admin.shared.search.search") %> <% end %> diff --git a/app/views/admin/local_census_records/index.html.erb b/app/views/admin/local_census_records/index.html.erb index 0278f8275..bac308537 100644 --- a/app/views/admin/local_census_records/index.html.erb +++ b/app/views/admin/local_census_records/index.html.erb @@ -13,7 +13,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.local_census_records.index.search.placeholder") %>
- <%= submit_tag t("admin.local_census_records.index.search.search"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index 8716668eb..8afaeedd8 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -6,7 +6,7 @@ <%= text_field_tag :search, "", placeholder: t("admin.organizations.index.search_placeholder") %>
- <%= f.submit t("admin.organizations.index.search"), class: "button" %> + <%= f.submit t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/organizations/search.html.erb b/app/views/admin/organizations/search.html.erb index 7d2cdb263..6f65f3843 100644 --- a/app/views/admin/organizations/search.html.erb +++ b/app/views/admin/organizations/search.html.erb @@ -5,7 +5,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.organizations.index.search_placeholder") %>
- <%= f.submit t("admin.organizations.index.search"), class: "button" %> + <%= f.submit t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/poll/booth_assignments/_search_booths.html.erb b/app/views/admin/poll/booth_assignments/_search_booths.html.erb index b8f5d7c80..adf7ed00d 100644 --- a/app/views/admin/poll/booth_assignments/_search_booths.html.erb +++ b/app/views/admin/poll/booth_assignments/_search_booths.html.erb @@ -5,7 +5,7 @@ @search, placeholder: t("admin.shared.booths_search.placeholder"), id: "search-booths" %>
- <%= submit_tag t("admin.shared.booths_search.button"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/poll/officer_assignments/_search_officers.html.erb b/app/views/admin/poll/officer_assignments/_search_officers.html.erb index 2e994fe8a..b1602dc7e 100644 --- a/app/views/admin/poll/officer_assignments/_search_officers.html.erb +++ b/app/views/admin/poll/officer_assignments/_search_officers.html.erb @@ -5,7 +5,7 @@ @search, placeholder: t("admin.shared.poll_officers_search.placeholder"), id: "search-officers" %>
- <%= submit_tag t("admin.shared.poll_officers_search.button"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/poll/officers/_search.html.erb b/app/views/admin/poll/officers/_search.html.erb index e61d9a73b..8980d5daf 100644 --- a/app/views/admin/poll/officers/_search.html.erb +++ b/app/views/admin/poll/officers/_search.html.erb @@ -5,7 +5,7 @@ <%= text_field_tag :search, "", placeholder: t("admin.poll_officers.search.email_placeholder") %>
- <%= submit_tag t("admin.poll_officers.search.search"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/poll/questions/_search.html.erb b/app/views/admin/poll/questions/_search.html.erb index e8a2c52c5..56127db13 100644 --- a/app/views/admin/poll/questions/_search.html.erb +++ b/app/views/admin/poll/questions/_search.html.erb @@ -4,7 +4,7 @@ @search, placeholder: t("admin.shared.poll_questions_search.placeholder") %>
- <%= submit_tag t("admin.shared.poll_questions_search.button"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/admin/shared/_booth_search.html.erb b/app/views/admin/shared/_booth_search.html.erb index eb22940db..ddaf5db0b 100644 --- a/app/views/admin/shared/_booth_search.html.erb +++ b/app/views/admin/shared/_booth_search.html.erb @@ -3,7 +3,7 @@
<%= text_field_tag :search, params[:search], placeholder: t("admin.shared.booths_search.placeholder") %>
- <%= f.submit t("admin.shared.booths_search.button"), class: "button" %> + <%= f.submit t("admin.shared.search.search"), class: "button" %>
diff --git a/app/views/admin/shared/_debate_search.html.erb b/app/views/admin/shared/_debate_search.html.erb index 42c9938d0..378d23ed4 100644 --- a/app/views/admin/shared/_debate_search.html.erb +++ b/app/views/admin/shared/_debate_search.html.erb @@ -3,7 +3,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.shared.debate_search.placeholder") %>
- <%= f.submit t("admin.shared.debate_search.button"), class: "button" %> + <%= f.submit t("admin.shared.search.search"), class: "button" %>
diff --git a/app/views/admin/shared/_proposal_search.html.erb b/app/views/admin/shared/_proposal_search.html.erb index 5a6207d4c..c8aee5e2a 100644 --- a/app/views/admin/shared/_proposal_search.html.erb +++ b/app/views/admin/shared/_proposal_search.html.erb @@ -3,7 +3,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.shared.proposal_search.placeholder") %>
- <%= f.submit t("admin.shared.proposal_search.button"), class: "button" %> + <%= f.submit t("admin.shared.search.search"), class: "button" %>
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 612f5d81d..4463ea2e7 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -5,7 +5,7 @@
<%= text_field_tag :search, "", placeholder: t("admin.users.search.placeholder") %>
- <%= submit_tag t("admin.users.search.search"), class: "button" %> + <%= submit_tag t("admin.shared.search.search"), class: "button" %>
<% end %> diff --git a/app/views/moderation/users/index.html.erb b/app/views/moderation/users/index.html.erb index 06403279e..7ea2180f1 100644 --- a/app/views/moderation/users/index.html.erb +++ b/app/views/moderation/users/index.html.erb @@ -6,7 +6,7 @@ <%= text_field_tag :search, "", placeholder: t("moderation.users.index.search_placeholder") %>
- <%= f.submit t("moderation.users.index.search"), class: "button success" %> + <%= f.submit t("admin.shared.search.search"), class: "button success" %>
<% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index cf330ae41..6c05bf15c 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -907,7 +907,6 @@ en: entry_name: officer search: email_placeholder: Search user by email - search: Search user_not_found: User not found help: "To add or remove Poll officers use the search form below." poll_officer_assignments: @@ -1170,7 +1169,6 @@ en: no_organizations: There are no organizations. reject: Reject rejected: Rejected - search: Search search_placeholder: Name, email or phone number title: Organisations verified: Verified @@ -1255,23 +1253,19 @@ en: shared: true_value: "Yes" false_value: "No" + search: + search: "Search" booths_search: - button: Search placeholder: Search booth by name or location poll_officers_search: - button: Search placeholder: Search poll officers poll_questions_search: - button: Search placeholder: Search poll questions proposal_search: - button: Search placeholder: Search proposals by title, code, description or question debate_search: - button: Search placeholder: Search debates by title or description user_search: - button: Search placeholder: Search user by name or email search_results: "Search results" no_search_results: "No results found." @@ -1440,7 +1434,6 @@ en: erased: Erased search: placeholder: Search user by email, name or document number - search: Search verifications: index: phone_not_given: Phone not given @@ -1581,7 +1574,6 @@ en: postal_code: Postal code search: placeholder: Search by document number - search: Search import: Import CSV new: creating: Creating new local census record diff --git a/config/locales/en/moderation.yml b/config/locales/en/moderation.yml index 01be3e57d..53b2ea64d 100644 --- a/config/locales/en/moderation.yml +++ b/config/locales/en/moderation.yml @@ -111,7 +111,6 @@ en: index: hidden: Blocked hide: Block - search: Search search_placeholder: email or name of user title: Block users notice_hide: User blocked. All of this user's debates and comments have been hidden. diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 18c87db4b..f970c74f4 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -906,7 +906,6 @@ es: entry_name: presidente de mesa search: email_placeholder: Buscar usuario por email - search: Buscar user_not_found: Usuario no encontrado help: "Para añadir o eliminar Presidentes de mesa utiliza el buscador a continuación." poll_officer_assignments: @@ -1169,7 +1168,6 @@ es: no_organizations: No hay organizaciones. reject: Rechazar rejected: Rechazada - search: Buscar search_placeholder: Nombre, email o teléfono title: Organizaciones verified: Verificada @@ -1254,23 +1252,19 @@ es: shared: true_value: "Sí" false_value: "No" + search: + search: "Buscar" booths_search: - button: Buscar placeholder: Buscar urna por nombre poll_officers_search: - button: Buscar placeholder: Buscar presidentes de mesa poll_questions_search: - button: Buscar placeholder: Buscar preguntas proposal_search: - button: Buscar placeholder: Buscar propuestas por título, código, descripción o pregunta debate_search: - button: Buscar placeholder: Buscar debates por título o descripción user_search: - button: Buscar placeholder: Buscar usuario por nombre o email search_results: "Resultados de la búsqueda" no_search_results: "No se han encontrado resultados." @@ -1439,7 +1433,6 @@ es: erased: Borrados search: placeholder: Buscar usuario por email, nombre o DNI - search: Buscar verifications: index: phone_not_given: No ha dado su teléfono @@ -1580,7 +1573,6 @@ es: postal_code: Código postal search: placeholder: Búsqueda por número de documento - search: Buscar import: Importar CSV new: creating: Creando nuevo registro de censo local @@ -1605,4 +1597,4 @@ es: errored: Filas erróneas created: Registros creados local_census_records: - no_records_found: No se han encontrado registros. \ No newline at end of file + no_records_found: No se han encontrado registros. diff --git a/config/locales/es/moderation.yml b/config/locales/es/moderation.yml index a31d7b6c5..968c7bfd0 100644 --- a/config/locales/es/moderation.yml +++ b/config/locales/es/moderation.yml @@ -111,7 +111,6 @@ es: index: hidden: Bloqueado hide: Bloquear - search: Buscar search_placeholder: email o nombre de usuario title: Bloquear usuarios notice_hide: Usuario bloqueado. Se han ocultado todos sus debates y comentarios.