Module: Edgarj::MenuHelper
- Includes:
- MenuConfig
- Defined in:
- app/helpers/edgarj/menu_helper.rb
Overview
draw Edgarj menu based on application’s menu configuration at config/edgarj/menu_config.rb.
Edgarj::MenuConfig should have ‘top’ module-function which returns arrays each entry is one of the followings:
-
item which contains link_to arg
-
controller menu list which contains controller name
-
special entry is ‘_separator’ which is not controller name, rather generates just menu separator.
-
See test/dummy/config/edgarj/menu_config.rb as an example.
SEE ALSO
- draw_menu
-
method to draw menu
FILE
- config/initializer/menu.rb
-
menu configuration at application
Instance Method Summary collapse
Instance Method Details
#draw_menu ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/edgarj/menu_helper.rb', line 23 def content_tag(:ul, :id=>'edgarj_menu', :class=>'edgarj_menu') do out = '' for in Edgarj::MenuConfig.top out += content_tag(:li) do case [0] when :item draw_item(*[1]) when :controller ([1], [2], [3]) else "unknown menu type: #{[0]}" end end end out.html_safe end end |