Skip to content

avarteqgmbh/very_nice_menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Very Nice Menu

This is a Ruby lib to create a tree of menus. Very nice. Really!

BTW this document is written with a certain portion of humor (insanity).

Features

  • Deeply nestable
  • You can have menus and entries mixed on every level.
  • Simple role based access control with permission inheritance that can be optionally switched of (see rbac_spec.rb for details.)

Test

Before your dirty hands touch a single line of code be sure to run the tests by invoking

rspec

Otherwise we’ll find and punish you! Promised.

Roadmap – The BIG P I C T U R E

  • First versions are about building a valid data structure needed to create menus.
  • The data model will be enhanced with information to later support authorization and visibility decisions.
  • Internationalization will also be prepared.
  • Then the problem of rendering menus will be targeted. This might become a framework specific renderer and thus end up in a separate repository but is surely part of the big picture.

Usage

menu = VeryNiceMenu.build('Main Menu', :allowed_for => [:admin])    
	menu.submenu("Main Menu - Submenu 1") do |submenu|        
		submenu.entry("My Entry")
	end
submenu = menu.submenus.first
  entry   = submenu.entries.first
menu.allowed_for?(:admin)
  => true
  menu.allowed_for?(:everyone)
  => false
submenu.allowed_for?(:admin)
  => true
  submenu.allowed_for?(:everyone)
  => false
entry.allowed_for?(:admin)
  => true
entry.allowed_for?(:everyone)
  => false

About

Ruby Gem to build - you wouldn't guess - very nice menus.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages