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:
@@ -32,18 +32,27 @@ class Admin::ActionComponent < ApplicationComponent
|
||||
{
|
||||
class: html_class,
|
||||
id: (dom_id(record, action) if record.respond_to?(:to_key)),
|
||||
"aria-describedby": describedby,
|
||||
"aria-label": label,
|
||||
data: {
|
||||
confirm: confirmation_text,
|
||||
disable_with: (text if button?)
|
||||
}
|
||||
}.merge(options.except(:"aria-label", :class, :confirm, :path, :text))
|
||||
}.merge(options.except(:"aria-describedby", :"aria-label", :class, :confirm, :path, :text))
|
||||
end
|
||||
|
||||
def html_class
|
||||
"admin-action #{options[:class] || "#{action.to_s.gsub("_", "-")}-link"}".strip
|
||||
end
|
||||
|
||||
def describedby
|
||||
if options[:"aria-describedby"] == true
|
||||
"#{dom_id(record, action)}_descriptor"
|
||||
else
|
||||
options[:"aria-describedby"]
|
||||
end
|
||||
end
|
||||
|
||||
def label
|
||||
if options[:"aria-label"] == true
|
||||
t("admin.actions.label", action: text, name: record_name)
|
||||
|
||||
Reference in New Issue
Block a user