Merrymenu

Installation

in Gemfile

gem 'merrumenu'

rails generate merrymenu:install

open config/initializers/merrymenu_config.rb and create your first menu

add merrymenu.css.scss to your stylesheet manifest (application.css)

Usage

in merrymenu_config.rb

Basic menu

Merrymenu::Builder.configure do |config|

  config.menu do |m|
    m.tab 'tab1', '/tab1'
    m.tab 'tab2', '/tab2'
    m.tab 'tab3', '/tab3'
  end
end

Named menu with classes on tabs

Merrymenu::Builder.configure do |config|

config.menu :admin do |m|
  m.tab 'tab1', '/tab1'
  m.tab 'tab2', '/tab2', :class => "left"
  m.tab 'tab3', '/tab3', :class => "right admin"

m.tab ‘tab4’, ‘/tab4’, :class => [“right”, “admin”]

  end
end

Set roles to display tabs to certain user

Merrymenu::Builder.configure do |config|

  config.menu do |m|
    m.tab 'tab1', '/tab1'
    m.tab 'tab2', '/tab2', :roles => "admin writer"
    m.tab 'tab3', '/tab3', :roles => "admin"
  end
end

warning : current_user method should respond true or false to has_roles?(roles=“”)

Use I18n translation for tab names

Merrymenu.configure do |config|

  config.use_I18n_translation = true
end

Merrymenu::Builder.configure do |config|

  config.menu do |m|
    m.tab 'menu.tab1', '/tab1'
    m.tab 'menu.tab2', '/tab2', :roles => "admin writer"
    m.tab 'menu.tab3', '/tab3', :roles => "admin"
  end
end

in views

render_menu render_menu :admin see app/assets/stylesheets/merrymenu.css.scss for styling

This project rocks and uses MIT-LICENSE.