h1. sinatra-simple-navigation

sinatra-simple-navigation is a sinatra extension enabling the use of the "simple-navigation":http://github.com/andi/simple-navigation gem in your sinatra and padrino applications.

h2. Installation

Either manually install the gem

@gem install sinatra-simple-navigation@

or preferably use bundler and add it to your Gemfile

@gem 'sinatra-simple-navigation'@

and run @bundle install@

h2. Usage

h3. Sinatra Applications

h4. Classic Style

To use simple-navigation in your classic style sinatra application, just require 'sinatra/simple-navigation':

<pre><code>require 'rubygems'
require 'sinatra'
require 'sinatra/simple-navigation'

# Your app code goes here</code></pre>

h4. Modular Style

If you're developing a module style sinatra application (i.e. subclassing Sinatra::Base), you have to register Sinatra::SimpleNavigation:

<pre><code>require 'rubygems'
require 'sinatra/base'
require 'sinatra/simple-navigation'

class MyApp < Sinatra::Base
  register Sinatra::SimpleNavigation
  
  # Your app code goes here
end</code></pre>

h3. Padrino Applications

Using simple-navigation in your padrino application is similar to the modular sinatra style. In your @app/app.rb@ file:

<pre><code>require 'sinatra/simple-navigation'

class MyApp < Padrino::Application
  register Sinatra::SimpleNavigation
  
  # Your app code goes here
end</code></pre>

Instead of requiring sinatra/simple-navigation at the top of the file, you could add this to your Gemfile:

@gem 'sinatra-simple-navigation', :require => 'sinatra/simple-navigation'@

h2. Resources

* simple-navigation source code: "http://github.com/andi/simple-navigation":http://github.com/andi/simple-navigation
* simple-navigation wiki: "http://wiki.github.com/andi/simple-navigation":http://wiki.github.com/andi/simple-navigation
* demo project with sample applications for rails, sinatra and padrino: "http://github.com/andi/simple-navigation-demo":http://github.com/andi/simple-navigation-demo

h2. Legal

Copyright (c) 2011 Andi Schacke, released under the MIT license
