Programming ≈ Fun

Enterprise Menu

You can check out emenu in action here.

If you have many options that are dependant on user role or licence you may want to try out what emenu has to offer. Main idea is to pull out menu definition in ruby based configuration.

  menu.item :orders do
    item :new_orders, cars_path
    item :look_at_orders do
      item :last_month_orders , last_month_orders_path
      item :all_orders, all_orders_path
    end
  end

I’ve opted out for internal DSL so it’s pure ruby, and you can add conditions as needed.

menu.conditions do
  item :really_neat_stuff, neat_path if user.admin?
  item :same_old_boring_crud, crud_path
end

I had a pretty complex html to generate, and I suspect you basically need it that way for anything that needs to look remotely normal. That’s why I’ve ran away from templates to code-based generation. It is straightforward to change code to support your specific styling needs.

Comments