Add information about budget actions

Both the calculate winners and delete actions benefit from some kind of
hint.

The "calculate winners" hint informs administrators that results won't
be publicly available unless the "show results" option is enabled.

The delete action was redirecting with an error message when the budget
couldn't be deleted; IMHO it's better to disable it and inform
administrators why it's disabled. Alternatively we could remove the
button completely; however, users might be looking for a way to delete a
budget and wouldn't find any hint about it.

We're now removing the "Delete" action from the budgets index table,
since most of the time it isn't possible to delete a budget and so the
action takes up space and we get little gain in return. We could keep
the "Delete" icon just for budgets which can be deleted; however, the
alignment of the table rows would suffer, making it harder to find the
intended action.
This commit is contained in:
Javi Martín
2021-08-30 18:36:24 +02:00
parent 0cc3f04096
commit 51a0bce58c
14 changed files with 208 additions and 55 deletions

View File

@@ -41,6 +41,31 @@ describe Admin::ActionComponent do
end
end
describe "aria-describedby attribute" do
it "is not rendered by default" do
render_inline Admin::ActionComponent.new(:edit, double, path: "/")
expect(page).to have_link count: 1
expect(page).not_to have_css "[aria-describedby]"
end
it "renders with the given value" do
render_inline Admin::ActionComponent.new(:edit, double, path: "/", "aria-describedby": "my_descriptor")
expect(page).to have_link count: 1
expect(page).to have_css "[aria-describedby='my_descriptor']"
end
it "renders a default value when aria-describedby is true" do
record = double(model_name: double(param_key: "book"), to_key: [23])
render_inline Admin::ActionComponent.new(:edit, record, path: "/", "aria-describedby": true)
expect(page).to have_link count: 1
expect(page).to have_css "[aria-describedby='edit_book_23_descriptor']"
end
end
describe "aria-label attribute" do
it "is not rendered by default" do
record = double(human_name: "Stay home")