Better way for creating menu n rails, whe can i read about this?

Hey

Better way for creating menu in rails, whe can i read about this? Wich gems better use or manually add? Maybe have topics about this, whe can i read more?

Dmitrij B. wrote in post #1105858:

Hey

Better way for creating menu in rails, whe can i read about this? Wich gems better use or manually add? Maybe have topics about this, whe can i read more?

You question is really to vague to answer properly. There are many different kinds of menus and many implementations. It depends very much on your specific needs.

A lot of the time I create my own menus manually using CSS and JavaScript when necessary. Other times I use a pre-built implementation.

There are many, as you can see here:

Or if you want a fully JavaScript implementation:

I did not mean html and css. I mean rails way. Maybe have helpers for this or use partial or better practice in rails

Dmitrij B. wrote in post #1105899:

I did not mean html and css. I mean rails way. Maybe have helpers for this or use partial or better practice in rails

Which is precisely why I linked to the list on ruby-toolbox. They are examples of menu systems designed to work with Rails. And their respective web sites and GitHub pages should give you plenty of content to read up on in choosing the right solution for your needs.

But, as I said choosing a solution is highly dependent on how complex your menu needs are. Some navigation systems are really simple and can be done entirely manually, others may benefit from one of those gems in the list.

And yes, use of partials and helpers are beneficial, but that's completely independent of what you are building. It makes no difference whether it is a menu that you're sharing, or anything else generic enough to share, that's the purpose of a partial. Helpers are generally used to move complex logic out of the view template, their role remains the same regardless of what you're building.

There is no one best way of creating menus, because people’s needs vary.

One simple example of creating menu you can find here: https://github.com/bigos/openshift-chrisbim/blob/master/app/views/layouts/application.html.haml

line 26: = render :partial => 'layouts/navbar'

Then in partial I had following code: https://github.com/bigos/openshift-chrisbim/blob/master/app/views/layouts/_navbar.html.haml

And this is relevant css: https://github.com/bigos/openshift-chrisbim/blob/master/app/assets/stylesheets/style.css.scss Please have a look at likes 57 to 72

Jacek