Custom navigation links *or* custom model actions

750 views
Skip to first unread message

Brian

unread,
Dec 26, 2011, 12:46:05 PM12/26/11
to rails_admin
I'm a big fan of "rails_admin" in many ways, so thank you to the
authors/community.

I have run into a bit of a snag though and after looking around the
forums I have not been able to find an answer. Hoping the group can
help.

I need a way to insert additional links to the main rails_admin
Navigation. Not everything involved in administering a site fits into
the bucket of CRUD operations on a model, and I'd like to be able to
expose those additional things (custom reports, etc) to my clients
through their main admin tool (rails_admin). I could build a separate
section of the site, with its own login, but that's dirty.

As a potential work-around (though I'd still vastly prefer what I just
described) I may be able to get by with adding a custom action to some
of my CRUD models.

I haven't been able to find out how to do either though. Does anyone
know?

Brian

unread,
Dec 26, 2011, 12:51:32 PM12/26/11
to rails_admin
To clarify, I am aware that I can override "app/views/layouts/
rails_admin/_navigation.html.haml" and add this behavior.

I was hoping to avoid overriding views though. This seems like
something that should be a relatively common request?

Benoit Bénézech

unread,
Dec 27, 2011, 7:20:29 AM12/27/11
to rails...@googlegroups.com
RailsAdmin was created all about CRUD and has been really model oriented from that day. 

There is no way good way to do what you're asking today.
Overriding the partial will give you time to come up with a better solution, if you want to get involved in the project. There is a pull request that you can start with. We would need smtg that integrates well with the DSL and the philosophy of the project.

Brian

unread,
Dec 27, 2011, 9:09:10 AM12/27/11
to rails_admin
Well I understand and appreciate the fact that Rails Admin's primary
purpose is simplifying CRUD operations. However, I think it's a weak-
point not to provide any hooks into which developers can link to other
types of administrative pages (of their own creation).

My initial stab at overriding the _navigation template has met with
only partial success. I was able to insert links, but it seems that
mounting the RailsAdmin::Engine at "/admin" pretty greedily slurps up
any and all links beginning with the text "/admin" and routes them to
the RailsAdmin::MainController. I think this means that approach is
out, and your suggestion of going the DSL route is probably a better
thing to try.

I'm a seasoned developer but I'm fairly new to Rails. As such I'm a
little hesitant to jump in and get involved with the project. (I'm
certainly willing, I'm just not sure I'm qualified quite yet.)

Benoit Bénézech

unread,
Dec 31, 2011, 11:11:04 AM12/31/11
to rails...@googlegroups.com
About the DSL route, I think we should add a navigation object. Configuring it from the every model object was a lazy move I took to stick with RA philosophy, but in the end it is not powerful enough to add other links.
Reply all
Reply to author
Forward
0 new messages