public
Description: Rails plugin: Site navigation via Controller Class Methods and one helper tag (Rails 2.2.2, Ruby 1.8.6)
Homepage:
Clone URL: git://github.com/AgileMantis/agile-mantis-navigation.git
name age message
file README Loading commit data...
directory plugins/
README
AgileMantisNavigation
=====================

Site navigation via Controller Class Methods and one helper tag.  No config files or hassling with mulitple links 
sprinkled across many views.
Sample controllers and CSS file included.

Features:
1 - Sort order, explicit or default of alphabetic.
2 - Security to determine (at time of render, not during app load), if a link should be rendered or not.
3 - Support for different css when user is "on" one of the page links (e.g. to remove underline, bold, change tab 
background, change hover, etc.)
4 - Visual seperators, or not, your choice (html or text)
5 - Support of 'link_to' helper, with both 'options' and 'html_options'
6 - Simple link definitions, if desired, or complex definitions.
7 - Auto discovery of links via Controller Class Methods upon initializaiton, no config files.
8 - Links defined in the controllers, a logical place to manage actions and their links.
9 - Support for Namespace Controllers

Examples
========

# Example: A simple link to the Gallery controler, index view:
def self.agile_mantis_navigation_primary
    { :name => 'Our Gallery' }
end

# Produces:
<div class="agile_mantis_navigation"><ul><li><a href="/gallery">Our Gallery</a></li></ul></div>

# If the Browser is 'on' the view, the link looks like:
<a href="/gallery" class="on">Our Gallery</a>

# Example: Multiple links, via an Array.  Explicit sort order and view definition:
def self.agile_mantis_navigation_primary
    links = Array.new
    links << { :name => 'About Us', :sort_order => 1, :link_to_options => { :action =>  'about' } } 
    links << { :name => 'Terms & Conditions', :sort_order => 99999, :link_to_options => { :action =>  'terms' } } 
end

# Security example:
def self.link_allowed_method
  true # Or custom logic
end

def self.agile_mantis_navigation_primary
  { :name => 'Admin Page', :permission => :link_allowed_method } 
end

Note: Recommended for main navigation w/links which are non distructive (e.g. gets only, no puts, posts, or delete - 
these were not tested and should no be part of any main navigation!)

Installation
============
1) Drop plugin in plugins folder
2) Add helper tag to layout:
   - No separator: <%= agile_mantis_navigation_links %>
   - Separator: <%= agile_mantis_navigation_links(" | ") %>  Replace pipe with text or html
3) Add CSS tags for a custom look/feel (see sample_app\public\stylesheets\agile_mantis_navigation.css for examples and 
tag names)
4) To override default sort order and use the :sort_order option, add the following to environment.rb
   AGILE_MANTIS_NAVIGATION_PRIMARY_SORT_ORDER = :use_sort_order_symbol  
5) Add links to controller methods self.agile_mantis_navigation_primary


Copyright (c) 2009 [Ledsworth Consluting LLC], released under the MIT license