Coder Social home page Coder Social logo

rocknrollmarc / sinatra-simple-navigation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeplant/sinatra-simple-navigation

0.0 1.0 0.0 224 KB

A Sinatra extension to enable creating navigations with the simple-navigation gem. Also works for Padrino.

Home Page: http://github.com/andi/simple-navigation

License: MIT License

sinatra-simple-navigation's Introduction

sinatra-simple-navigation

sinatra-simple-navigation is a sinatra extension enabling the use of the simple-navigation gem in your sinatra and padrino applications.

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

Usage

Sinatra Applications

Classic Style

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

require 'rubygems'
require 'sinatra'
require 'sinatra/simple-navigation'

# Your app code goes here

Modular Style

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

require 'rubygems'
require 'sinatra/base'
require 'sinatra/simple-navigation'

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

Padrino Applications

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

require 'sinatra/simple-navigation'

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

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'

Resources

Legal

Copyright © 2014 codeplant GmbH, released under the MIT license

sinatra-simple-navigation's People

Contributors

andi avatar mjtko avatar simonc avatar synrg avatar

Watchers

RocknrollMarc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.