diff --git a/app/helpers/audits_helper.rb b/app/helpers/audits_helper.rb new file mode 100644 index 000000000..e69c65fa7 --- /dev/null +++ b/app/helpers/audits_helper.rb @@ -0,0 +1,11 @@ +module AuditsHelper + def truncate_audit_value(resource, field, value) + if value.is_a?(Array) + truncate(value.join(","), length: 50) + elsif resource.type_for_attribute(field.to_s).type == :boolean + resource.class.human_attribute_name("#{field}_#{value}") + else + truncate(value.to_s, length: 50) + end + end +end diff --git a/app/views/admin/audits/_audits.html.erb b/app/views/admin/audits/_audits.html.erb index dc7bf87b1..f607b907d 100644 --- a/app/views/admin/audits/_audits.html.erb +++ b/app/views/admin/audits/_audits.html.erb @@ -20,15 +20,15 @@ <% audit.audited_changes.each do |field, (old_value, new_value)| %> <%= audit.id %> - <%= field.capitalize %> + <%= sanitize(resource.class.human_attribute_name(field)) %> -
<%= old_value %>
+
<%= truncate_audit_value(resource, field, old_value) %>
-
<%= new_value %>
+
<%= truncate_audit_value(resource, field, new_value) %>
- <%= audit.created_at.to_date %> + <%= l audit.created_at.to_date %> <%= audit.user&.name %> diff --git a/app/views/admin/budget_investments/_written_by_author.html.erb b/app/views/admin/budget_investments/_written_by_author.html.erb index f030aac91..63e48d4b6 100644 --- a/app/views/admin/budget_investments/_written_by_author.html.erb +++ b/app/views/admin/budget_investments/_written_by_author.html.erb @@ -41,7 +41,7 @@

<%= t("admin.budget_investments.show.selection.title") %>: - <%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %> + <%= @investment.class.human_attribute_name("selected_#{@investment.selected?}") %>

diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index 82091f0f4..e4acbae92 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -161,6 +161,8 @@ en: milestone_tag_list: "Milestone tags" price_explanation: "Price explanation" selected: "Mark as selected" + selected_true: "Selected" + selected_false: "Not selected" unfeasibility_explanation: "Feasibility explanation" valuation_finished: "Valuation finished" valuator_ids: "Groups" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index cdde55e9e..568a1410b 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -241,8 +241,6 @@ en: "false": Compatible selection: title: Selection - "true": Selected - "false": Not selected winner: title: Winner "true": "Yes" @@ -1592,7 +1590,7 @@ en: edited_at: "Edited at" edited_by: "Edited by" actions: "Actions" - empty: "There are not changes logged" + empty: "There are no changes logged" local_census_records: index: title: Manage local census diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml index 5fe4b0d77..69c5f1956 100644 --- a/config/locales/es/activerecord.yml +++ b/config/locales/es/activerecord.yml @@ -163,6 +163,8 @@ es: milestone_tag_list: "Etiquetas de Seguimiento" price_explanation: "Informe de coste (opcional, dato público)" selected: "Marcar como seleccionado" + selected_true: "Seleccionado" + selected_false: "No seleccionado" unfeasibility_explanation: "Informe de inviabilidad (en caso de que lo sea, dato público)" valuation_finished: "Informe finalizado" valuator_ids: "Grupos" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 5f376fe44..89eeeb289 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -241,8 +241,6 @@ es: "false": Compatible selection: title: Selección - "true": Seleccionado - "false": No seleccionado winner: title: Ganador "true": "Si" diff --git a/spec/features/admin/change_log_spec.rb b/spec/features/admin/change_log_spec.rb index 963e63554..a472ba5e1 100644 --- a/spec/features/admin/change_log_spec.rb +++ b/spec/features/admin/change_log_spec.rb @@ -27,7 +27,7 @@ describe "Admin change log" do expect(page).to have_content(budget_investment.description) expect(page).to have_content(budget_investment.author.name) expect(page).to have_content(budget_investment.heading.name) - expect(page).to have_content("There are not changes logged") + expect(page).to have_content("There are no changes logged") end scenario "Changes" do @@ -46,13 +46,13 @@ describe "Admin change log" do expect(page).to have_content(budget_investment.description) expect(page).to have_content(budget_investment.author.name) expect(page).to have_content(budget_investment.heading.name) - expect(page).to have_content("There are not changes logged") + expect(page).to have_content("There are no changes logged") click_link "Edit" fill_in "Title", with: "test" click_button "Update" - expect(page).not_to have_content("There are not changes logged") + expect(page).not_to have_content("There are no changes logged") expect(page).to have_content("Change Log") expect(page).to have_content("Title") expect(page).to have_content("test")