No commit activity in last 3 years
No release in over 3 years
Template inheritance provided by Rango in Rails!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

About

This Rails plugin provides template inheritance from Rango for Rails, so you can just install it and enjoy advantages of template inheritance without any framework switching.

Please note that this plugin works just with Ruby 1.9.1 and higher!

See an example application

Template Inheritance

Template inheritance is incredibly simple, powerful and flexible way how to handle layout/template. You usually needs more levels of layouting and you can do it very easily with template inheritance. You can have i. e. app/views/admin/posts/show.html.haml with post-specific stuff, then app/views/admin/base.html.haml with administration-specific layout and then app/views/base.html.haml with the most generic layout.

See also explanation at DjangoProject.com

Rango

Rango is a light-weight web framework suitable for both smaller web services and bigger sites. It’s builded on top of Rack and it has very flexible and modular architecture. So modular that we can even use it in Rails as a drop-in replacement for Rails rendering layer.

- Rango Wiki
- Rango Introduction from Ruby Manor 2009

Template Adapters

Thanks to Tilt you can use Erubis or Haml, just by using the proper extension. Tilt itself supports much more, however Rango currently support just these two engines. Some engines won’t be supported just because they don’t support Ruby code in templates (Mustache and Liquid) etc.

Usage

As a Plugin

./script/plugin install git://github.com/botanicus/rails-template-inheritance.git

As a Gem

Add these lines into your config/environment.rb:

config.gem "tilt"
config.gem "rango", lib: nil
config.gem "rails-template-inheritance", lib: nil

Now run following tasks:

rake gems:install
rake gems:unpack

Via bundler

This is definitely the best solution since plugins can’t handle dependencies and Rails 2 bundling tasks are just general pain in the ass.

Just put gem "rails-template-inheritance" to your Gemfile and run gem bundle (you have to have bundler installed). Then you have to setup your config/environment.rb:

require_relative "../vendor/gems/environment"
Bundler.require_env(Rails.env)