I applied a rails_admin gem in my Rails app. I want to remove some unnecessary buttons in a specific model edit form, and add my own custom button instead. Please see the screenshot for what I'd like to remove.
Asked
Active
Viewed 1,586 times
7
-
did you resolve? how? – Montells Mar 08 '16 at 19:27
-
@montells Yes I resolve this – ashvin Mar 31 '16 at 09:19
1 Answers
6
@montells Copy https://github.com/sferik/rails_admin/blob/master/app/views/rails_admin/main/_submit_buttons.html.haml this page in your repo at "views/rails_admin/main/_submit_buttons.html.haml"
Now in this file, you can put the condition in which page you want to remove button e.g.
- if params[:model_name]
- if params[:model_name] != "model_name_in_which_you_want_hide_button"
"Paste above url view"

Praveen Kumar
- 864
- 2
- 9
- 33

ashvin
- 2,020
- 1
- 16
- 33
-
Hey @ashvin, how did you configured this button templates? Could you help me out here? – Agustin Feb 24 '18 at 19:08
-
-
The `save and edit` ones, in fact my question was a bit wrong, I wanted to know where or how did you configure rails_admin to use `views/rails_admin/main/_submit_button.html.haml`, thanks in advance! @ashvin – Agustin Feb 26 '18 at 15:31
-
Please read my answer it will solve your problem. Still if you didn't get let me know. – ashvin Feb 27 '18 at 04:07
-
I did that but I am missing some config, is it possible that you send me the config file example? The exact part on where the buttons are configured on rails_admin.rb. Thanks @ashvin – Agustin Feb 27 '18 at 13:02
-
1Rails Admin is 'magic' in that there doesn't need to be an config. If you have a view/rails_admin/main file with the same name was one that's default it just uses yours rather than the default. – J.R. May 20 '19 at 15:57