From 2e70b706b0f9cbda2198f915d91f08d865601034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 31 Aug 2021 22:05:37 +0200 Subject: [PATCH] Reduce the information shown in the headings table The population field is optional and only used for statistic purposes, and the content block feature is also secondary, so IMHO it's OK if we don't display it in the index; if administrators need this information, they can see it by going to the "edit heading" page. With this change it's easier to navigate the table on small and medium screens. Actually, the whole page is easier to navigate, since we greatly reduce the cases where a horizontal scrollbar is present. --- .../headings_component.html.erb | 6 ---- config/locales/en/admin.yml | 2 -- config/locales/es/admin.yml | 2 -- spec/system/admin/budget_headings_spec.rb | 33 +++++++------------ 4 files changed, 11 insertions(+), 32 deletions(-) diff --git a/app/components/admin/budget_headings/headings_component.html.erb b/app/components/admin/budget_headings/headings_component.html.erb index 4823e58e7..e18ecaa94 100644 --- a/app/components/admin/budget_headings/headings_component.html.erb +++ b/app/components/admin/budget_headings/headings_component.html.erb @@ -7,8 +7,6 @@ <% if budget.approval_voting? %> <%= Budget::Heading.human_attribute_name(:max_ballot_lines) %> <% end %> - <%= Budget::Heading.human_attribute_name(:population) %> - <%= Budget::Heading.human_attribute_name(:allow_custom_content) %> <%= t("admin.actions.actions") %> @@ -20,10 +18,6 @@ <% if budget.approval_voting? %> <%= heading.max_ballot_lines %> <% end %> - <%= heading.population %> - - <%= heading.allow_custom_content ? t("admin.shared.true_value") : t("admin.shared.false_value") %> - <%= render Admin::TableActionsComponent.new(heading) %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 5e04255ff..44a84c073 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -1329,8 +1329,6 @@ en: setting_value: Value no_description: "No description" shared: - true_value: "Yes" - false_value: "No" search: advanced_filters: sdg_goals: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 0269be9d0..b8d19a4f7 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -1328,8 +1328,6 @@ es: setting_value: Valor no_description: "Sin descripción" shared: - true_value: "Sí" - false_value: "No" search: advanced_filters: sdg_goals: diff --git a/spec/system/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb index 59ae87b30..fa130efe6 100644 --- a/spec/system/admin/budget_headings_spec.rb +++ b/spec/system/admin/budget_headings_spec.rb @@ -27,9 +27,9 @@ describe "Admin budget headings", :admin do end scenario "Displaying headings" do - create(:budget_heading, name: "Laptops", group: group, price: 1000, allow_custom_content: true) - create(:budget_heading, name: "Tablets", group: group, price: 2000, population: 10000) - create(:budget_heading, name: "Phones", group: group, price: 3000, population: 20000) + create(:budget_heading, name: "Laptops", group: group, price: 1000) + create(:budget_heading, name: "Tablets", group: group, price: 2000) + create(:budget_heading, name: "Phones", group: group, price: 3000) visit admin_budget_path(budget) @@ -37,23 +37,9 @@ describe "Admin budget headings", :admin do within "tbody" do expect(page).to have_selector "tr", count: 3 - within "tr", text: "Laptops" do - expect(page).to have_content "€1,000" - expect(page).not_to have_content "10000" - expect(page).to have_content "Yes" - end - - within "tr", text: "Tablets" do - expect(page).to have_content "€2,000" - expect(page).to have_content "10000" - expect(page).to have_content "No" - end - - within "tr", text: "Phones" do - expect(page).to have_content "€3,000" - expect(page).to have_content "20000" - expect(page).to have_content "No" - end + within("tr", text: "Laptops") { expect(page).to have_content "€1,000" } + within("tr", text: "Tablets") { expect(page).to have_content "€2,000" } + within("tr", text: "Phones") { expect(page).to have_content "€3,000" } end end end @@ -100,9 +86,12 @@ describe "Admin budget headings", :admin do within "tr", text: "All City" do expect(page).to have_content "€1,000" - expect(page).to have_content "10000" - expect(page).to have_content "Yes" + + click_link "Edit" end + + expect(page).to have_field "Population (optional)", with: "10000" + expect(page).to have_field "Allow content block", checked: true end scenario "Heading name is mandatory" do