From e64289c5f94462fbc1f5a3cde220f36d81fcbc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 19:06:11 +0200 Subject: [PATCH 1/9] Fix double quotes inside double quotes The interpolation was being evaluated as a comment. --- spec/features/admin/poll/booth_assigments_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/admin/poll/booth_assigments_spec.rb b/spec/features/admin/poll/booth_assigments_spec.rb index 169956362..a8243580e 100644 --- a/spec/features/admin/poll/booth_assigments_spec.rb +++ b/spec/features/admin/poll/booth_assigments_spec.rb @@ -25,7 +25,7 @@ describe "Admin booths assignments" do click_link "Manage assignments" end - expect(page).to have_content "Assignments for poll "#{second_poll.name}"" + expect(page).to have_content "Assignments for poll '#{second_poll.name}'" expect(page).to have_content(booth.name) expect(page).to have_content(second_booth.name) @@ -46,7 +46,7 @@ describe "Admin booths assignments" do visit manage_admin_poll_booth_assignments_path(poll) - expect(page).to have_content "Assignments for poll "#{poll.name}"" + expect(page).to have_content "Assignments for poll '#{poll.name}'" within("#poll_booth_#{booth.id}") do expect(page).to have_content(booth.name) @@ -85,7 +85,7 @@ describe "Admin booths assignments" do visit manage_admin_poll_booth_assignments_path(poll) - expect(page).to have_content "Assignments for poll "#{poll.name}"" + expect(page).to have_content "Assignments for poll '#{poll.name}'" within("#poll_booth_#{booth.id}") do expect(page).to have_content(booth.name) From 3a2818ece501759e2df5fcb9f0db9983749ed520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 21:25:27 +0200 Subject: [PATCH 2/9] Remove unused method This method was not used since commit d0245059. --- app/models/geozone.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/geozone.rb b/app/models/geozone.rb index 345e040d1..667ec98f7 100644 --- a/app/models/geozone.rb +++ b/app/models/geozone.rb @@ -13,10 +13,6 @@ class Geozone < ApplicationRecord Geozone.pluck(:name) end - def self.city - where(name: "city").first - end - def safe_to_destroy? Geozone.reflect_on_all_associations(:has_many).all? do |association| association.klass.where(geozone: self).empty? From 7c252750c9ddd477070d40cc3f8b9c03ea6766cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 22:00:01 +0200 Subject: [PATCH 3/9] Remove duplicated call to index customization The statement executed the method twice if the `present?` condition was true. If the condition was false, it executed it once anyway. It's probably a typo and originally we probably meant we wanted to execute the method if the method existed. --- app/controllers/concerns/commentable_actions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 2c6d1da81..bb610d4a6 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -16,7 +16,7 @@ module CommentableActions @resources = @resources.page(params[:page]).send("sort_by_#{@current_order}") - index_customization if index_customization.present? + index_customization @tag_cloud = tag_cloud @banners = Banner.in_section(section(resource_model.name)).with_active From 612e5ad8328423e90f9c45a76ae7368da06ef56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 23 Jun 2019 15:13:14 +0200 Subject: [PATCH 4/9] Remove unused trackers form This file was probably generated automatically and we forgot to remove it. We never use it; the edit action includes its own form. --- app/views/admin/trackers/_form.html.erb | 32 ------------------------- 1 file changed, 32 deletions(-) delete mode 100644 app/views/admin/trackers/_form.html.erb diff --git a/app/views/admin/trackers/_form.html.erb b/app/views/admin/trackers/_form.html.erb deleted file mode 100644 index f9385c65a..000000000 --- a/app/views/admin/trackers/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_for(tracker) do |f| %> - <% if tracker.errors.any? %> -
-

<%= pluralize(tracker.errors.count, "error") %> prohibited this tracker from being saved:

- -
    - <% tracker.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
- <% end %> - -
- <%= f.label :user_id %> - <%= f.text_field :user_id %> -
- -
- <%= f.label :description %> - <%= f.text_field :description %> -
- -
- <%= f.label :budget_investment_count %> - <%= f.number_field :budget_investment_count %> -
- -
- <%= f.submit %> -
-<% end %> From 06be5e132f41bf4ff012943297f4567cd6dbc9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 23 Jun 2019 15:41:54 +0200 Subject: [PATCH 5/9] Fix label in form to add own answer The label text was always in English, and it wasn't associated with any input field. The `SecureRandom` part is a quick hack so we don't get duplicate IDs. Using "your_answer_#{question.id}" might work as well, but right now I'm not sure if the form is sometimes rendered twice for the same question. --- app/views/polls/questions/_new_answer.html.erb | 7 ++++--- config/locales/en/general.yml | 1 + config/locales/es/general.yml | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/polls/questions/_new_answer.html.erb b/app/views/polls/questions/_new_answer.html.erb index 2f056bafa..9df88a7e7 100644 --- a/app/views/polls/questions/_new_answer.html.erb +++ b/app/views/polls/questions/_new_answer.html.erb @@ -1,5 +1,6 @@ <%= form_tag(create_answer_question_path(question, token: token), method: :post, remote: true) do %> - - - "> + <% id = "your_answer_#{SecureRandom.hex}" %> + <%= label_tag :answer, t("poll_questions.show.your_answer"), for: id %> + <%= text_field_tag :answer, nil, class: "medium-10", id: id %> + <%= submit_tag t("poll_questions.show.add_answer"), class: "button success" %> <% end %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 2ea40d22e..1b9adb735 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -701,6 +701,7 @@ en: show: vote_answer: "Vote %{answer}" voted: "You have voted %{answer}" + your_answer: "You can add your own answer" add_answer: "Add answer" description: multiple: "You can select a maximum of %{maximum} answers." diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index f879e29aa..f55bb69d8 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -699,6 +699,7 @@ es: show: vote_answer: "Votar %{answer}" voted: "Has votado %{answer}" + your_answer: "Puedes añadir tu propia respuesta" add_answer: "Añadir respuesta" description: multiple: "Puedes seleccionar un máximo de %{maximum} respuestas." From 29da91a0828ec5ebc569f6bcb47b42961ef9ec69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 23 Jun 2019 15:48:27 +0200 Subject: [PATCH 6/9] Fix untranslated texts I've also renamed the key for the settings title so the `

` gets the `title` key, as done in other sections in the admin. --- app/views/admin/settings/_configuration_settings_tab.html.erb | 2 +- app/views/admin/settings/_filter_subnav.html.erb | 2 +- app/views/admin/settings/index.html.erb | 2 +- app/views/admin/shared/_columns_selector.html.erb | 4 ++-- app/views/layouts/mailer.html.erb | 2 +- config/locales/en/admin.yml | 4 +++- config/locales/en/mailers.yml | 1 + config/locales/es/admin.yml | 2 ++ config/locales/es/mailers.yml | 1 + 9 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/views/admin/settings/_configuration_settings_tab.html.erb b/app/views/admin/settings/_configuration_settings_tab.html.erb index 84f21559b..b33fa9371 100644 --- a/app/views/admin/settings/_configuration_settings_tab.html.erb +++ b/app/views/admin/settings/_configuration_settings_tab.html.erb @@ -1,3 +1,3 @@ -

<%= t("admin.settings.index.title") %>

+

<%= t("admin.settings.index.general") %>

<%= render "settings_table", settings: @configuration_settings, setting_name: "setting", tab: "#tab-configuration" %> diff --git a/app/views/admin/settings/_filter_subnav.html.erb b/app/views/admin/settings/_filter_subnav.html.erb index 09d2d240b..cdd095d0d 100644 --- a/app/views/admin/settings/_filter_subnav.html.erb +++ b/app/views/admin/settings/_filter_subnav.html.erb @@ -7,7 +7,7 @@ data-tabs>
  • <%= link_to "#tab-configuration" do %> - <%= t("admin.settings.index.title") %> + <%= t("admin.settings.index.general") %> <% end %>
  • diff --git a/app/views/admin/settings/index.html.erb b/app/views/admin/settings/index.html.erb index 56d727887..9e417dc0e 100644 --- a/app/views/admin/settings/index.html.erb +++ b/app/views/admin/settings/index.html.erb @@ -1,4 +1,4 @@ -

    Settings

    +

    <%= t("admin.settings.index.title") %>

    <%= render "filter_subnav" %> diff --git a/app/views/admin/shared/_columns_selector.html.erb b/app/views/admin/shared/_columns_selector.html.erb index a48a17f3f..dfae1d808 100644 --- a/app/views/admin/shared/_columns_selector.html.erb +++ b/app/views/admin/shared/_columns_selector.html.erb @@ -1,11 +1,11 @@ "> - Columns + <%= t("admin.budget_investments.index.columns") %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 9431845dd..b11d38a3a 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,7 +1,7 @@ - Gobierno abierto + <%= t("mailers.title") %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 967186cf1..8ce3dab12 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -224,6 +224,7 @@ en: download_current_selection: "Download current selection" no_budget_investments: "There are no investment projects." title: Investment projects + columns: Columns assigned_admin: Assigned administrator no_admin_assigned: No admin assigned no_valuators_assigned: No valuators assigned @@ -1291,7 +1292,8 @@ en: flash: updated: Value updated index: - title: Configuration settings + title: Settings + general: Configuration settings update_setting: Update participation_processes: "Participation processes" images_and_documents: "Images and documents" diff --git a/config/locales/en/mailers.yml b/config/locales/en/mailers.yml index a1151d57d..6434b8951 100644 --- a/config/locales/en/mailers.yml +++ b/config/locales/en/mailers.yml @@ -1,5 +1,6 @@ en: mailers: + title: "Open Government" no_reply: "This message was sent from an email address that does not accept replies." comment: hi: Hi diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index bdf7eaffb..a87554c0d 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -224,6 +224,7 @@ es: download_current_selection: "Descargar selección actual" no_budget_investments: "No hay proyectos de gasto." title: Proyectos de gasto + columns: Columnas assigned_admin: Administrador asignado no_admin_assigned: Sin admin asignado no_valuators_assigned: Sin evaluador @@ -1293,6 +1294,7 @@ es: updated: Valor actualizado index: title: Configuración global + general: Configuración global update_setting: Actualizar participation_processes: "Procesos de participación" images_and_documents: "Imágenes y documentos" diff --git a/config/locales/es/mailers.yml b/config/locales/es/mailers.yml index 92a810b39..fa37c399a 100644 --- a/config/locales/es/mailers.yml +++ b/config/locales/es/mailers.yml @@ -1,5 +1,6 @@ es: mailers: + title: "Gobierno abierto" no_reply: "Este mensaje se ha enviado desde una dirección de correo electrónico que no admite respuestas." comment: hi: Hola From 4ab535dec45821b233880c8fdbcf07e309d230fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 5 Jul 2019 04:59:27 +0200 Subject: [PATCH 7/9] Remove comma inside a HTML tag The typo was detected thanks to erb-lint SpaceInHtmlTag rule. --- .erb-lint.yml | 6 ++++-- app/views/management/user_invites/new.html.erb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.erb-lint.yml b/.erb-lint.yml index 895a9d799..71b368cee 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -2,10 +2,12 @@ linters: FinalNewline: enabled: true - SpaceAroundErbTag: - enabled: true SelfClosingTag: enabled: false + SpaceAroundErbTag: + enabled: true + SpaceInHtmlTag: + enabled: true Rubocop: enabled: true only: diff --git a/app/views/management/user_invites/new.html.erb b/app/views/management/user_invites/new.html.erb index b8687e82d..f8d0aae26 100644 --- a/app/views/management/user_invites/new.html.erb +++ b/app/views/management/user_invites/new.html.erb @@ -7,6 +7,6 @@ placeholder: t("management.user_invites.new.info"), aria: {describedby: "emails-help-text"} %>
    - ", class="button expanded"> + " class="button expanded">
    <% end %> From 6ab2e5c16ced959d13fe4f985517dc5617797204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 5 Jul 2019 05:01:34 +0200 Subject: [PATCH 8/9] Add missing quotes for HTML attribute --- app/views/shared/_advanced_search.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_advanced_search.html.erb b/app/views/shared/_advanced_search.html.erb index dc82c0714..5399da18d 100644 --- a/app/views/shared/_advanced_search.html.erb +++ b/app/views/shared/_advanced_search.html.erb @@ -4,7 +4,7 @@
    <%= form_tag search_path, id: "advanced_search_form", method: :get do %> -