tog / tog watch
public
Description: Base gem that bootstrap tog platform configuration in a Rails app
Home | Edit | New

Customizing the menus

Just notes at this point, it should help you get started

Through Tog::Interface you can build the tabs/subtab navigation structure. There are 3 main sections defined by default in tog: admin, member and site and you can add tabs/subtabs to any of them.

By default the tab names are i18n strings based in the key you give them in the creation following the convention key.to_s.downcase.gsub(/ /, ‘_’) and appending “_items” for the subnav items.

The environment.rb file is a good location to set the menu information so that the menus will be preset when the site is initiated.

Tog::Interface.sections(section).function key, url, { options }

Tog::Interface.sections(:member).add “My Options”, “/member/options”, {:before => ’Messages’}

functions

clear – clear the menu items?
add – add a menu item params key, url, options
remove – remove a menu item param key
size – return the number of tabs in the menu
tabs – params ( optional key) – return a list of tabs

options

:after => key position for the added tab
:before => key position for the added tab
:for => {roles} visibility for specific roles (:all by default) ?
:visibility => {roles} visibility for specific roles (:all by default) ?

I have not test it, but I suspect that you can also dynamically add menu tabs, making the same calls in your code.

Last edited by pacoguzman, Wed Oct 14 06:55:01 -0700 2009
Home | Edit | New
Versions: