GAV1N/fat-free-semantic-menu
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
= Fat Free Semantic Menu
Fat Free Semantic Menu is a multi-level menu plugin for use with Fat Free CRM by Michel Dvorkin. This is based on danielharan's SemanticMenu plugin.
I haven't customized the CSS yet to actually look decent with Fat Free CRM.
= Here's how to use this plugin
1. Add the menu items and level 1 and level 2 children to config/settings.yml as follows:
:tabs: [
{ :active : true, :text : "Dashboard", :url : { :controller : "/" } },
{ :active : false, :text : "Tasks", :url : { :controller : "tasks" } ,
:children : [ { :active : false, :text : "Level 1 child 1", :url : { :controller : "home" },
:children : [ { :active : false, :text : "Level 2 child 1", :url : { :controller : "home" }},
{ :active : false, :text : "Level 2 child 2", :url : { :controller : "home" }} ]
},
{ :active : false, :text : "Level 1 child 2", :url : { :controller : "campaigns" } } ]
},
{ :active : false, :text : "Campaigns", :url : { :controller : "campaigns" } },
{ :active : false, :text : "Leads", :url : { :controller : "leads" } },
{ :active : false, :text : "Accounts", :url : { :controller : "accounts" } },
{ :active : false, :text : "Contacts", :url : { :controller : "contacts" } },
{ :active : false, :text : "Opportunities", :url : { :controller : "opportunities" } }
]
2. Run 'rake crm:settings:load' to load the settings to the database.
3. In app/views/layouts/_tabbed.html.haml, replace the following lines:
#tabs
%ul
- tabs.each do |tab|
%li= link_to(tab[:text], tab[:url], :class => tab[:active] ? "active" : "")
With these lines:
#tabs
= fat_free_semantic_menu
4. Start up your server and see the new multi-level menu. Obviously, we need some CSS work to make this look alright. But this is a start...
The plugin sets the active tab based on the @current_tab instance variable set within the controller. If @current_tab is nil, it attempts to find the current tab by matching the request URL to each menu item's link.