Hi,
Is there a clean way to customise the label of an action item ?
_Note : Active Admin 1.0.0.pre_
For example, if I register a Page resource with locale set to :fr
I then have a new action link with the label Nouveau Page but in french page is feminine so the right way would be Nouvelle Page.
I found the following solution:
ActiveAdmin.register Page do
config.clear_action_items!
action_item :only => :index do
link_to "Nouvelle Page", new_admin_page_path
end
end
but I would only like to change the label and not rewrite the whole stuff ?
By the way, thanks for the job on ActiveAdmin.
IRC Discussion on this topic.
Summary of temporary workaround:
config.action_items[0] = ActiveAdmin::ActionItem.new only: :index do
link_to "Foo", new_admin_foo_path
end
This would keep all the other action items in place (i.e. edit, destroy) without having to redefine them.
There is some brainstorming further down in the IRC discussing ways to make this easier, but not sure if it or anything like it is going to get implemented any time soon.
Thanks @shekibobo for your support. Yes it's nicer to not have to redefine all the action items. Personally I would see something like the following:
action_item :new, only: :index, label: 'Nouvelle Page'
but it does not seem obvious to change this by reading the code.
Unfortunately, I fell back with the customization of the locale file with a more generic (but uglier) word because the page title kept the old one, in my case Nouveau Page.
Feel free to close the case if you will ;)
Most helpful comment
IRC Discussion on this topic.
Summary of temporary workaround:
This would keep all the other action items in place (i.e. edit, destroy) without having to redefine them.
There is some brainstorming further down in the IRC discussing ways to make this easier, but not sure if it or anything like it is going to get implemented any time soon.