Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize action item label #3035

Closed
afriqs opened this issue Mar 31, 2014 · 3 comments
Closed

Customize action item label #3035

afriqs opened this issue Mar 31, 2014 · 3 comments

Comments

@afriqs
Copy link

afriqs commented Mar 31, 2014

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.

@shekibobo
Copy link
Contributor

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.

@afriqs
Copy link
Author

afriqs commented Apr 1, 2014

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 ;)

@afriqs afriqs changed the title Customize action label label Customize action item label Apr 1, 2014
@timoschilling timoschilling self-assigned this Oct 21, 2014
@timoschilling
Copy link
Member

#2823 fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants