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.
This commit is contained in:
Javi Martín
2021-08-31 22:05:37 +02:00
parent 1b407b0702
commit 2e70b706b0
4 changed files with 11 additions and 32 deletions

View File

@@ -7,8 +7,6 @@
<% if budget.approval_voting? %>
<th><%= Budget::Heading.human_attribute_name(:max_ballot_lines) %></th>
<% end %>
<th><%= Budget::Heading.human_attribute_name(:population) %></th>
<th><%= Budget::Heading.human_attribute_name(:allow_custom_content) %></th>
<th><%= t("admin.actions.actions") %></th>
</tr>
</thead>
@@ -20,10 +18,6 @@
<% if budget.approval_voting? %>
<td><%= heading.max_ballot_lines %></td>
<% end %>
<td><%= heading.population %></td>
<td>
<%= heading.allow_custom_content ? t("admin.shared.true_value") : t("admin.shared.false_value") %>
</td>
<td>
<%= render Admin::TableActionsComponent.new(heading) %>
</td>

View File

@@ -1329,8 +1329,6 @@ en:
setting_value: Value
no_description: "No description"
shared:
true_value: "Yes"
false_value: "No"
search:
advanced_filters:
sdg_goals:

View File

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

View File

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