Git Product home page Git Product logo

inherit_views's Introduction

Status

inherit_views works with rails 2.x

If you’re on rails 2.3 or rails edge, you want inherit_views/master

If you’re on rails 2.2, you want inherit_views/rails-2.2

If you’re on rails 2.0, or 2.1, you want inherit_views/rails-2.0-2.1

what does it do?

This rails plugin allows your controllers/mailers to inherit their views from parent controllers/mailers. The default behaviour is to inherit along the ancestor path of the controller/mailer, but you can also specify custom inherit view paths to search.

Example:

class ApplicationController < ActionController::Base
  inherit_views
end

class FooController < ApplicationController
  # will look for views in 'views/foo', then 'views/application'
end

class BarController < FooController
  # will look for views in 'views/bar', then 'views/foo', then 'view/application'
end

See InheritViews for more details

NOTE: this plugin is not aimed at having multiple view paths for your controllers, which is addressed with the view_paths addition to ActionController::Base for rails 2.0. Rather, within these view paths, you can inherit views from other controller paths.

In templates

You can render the ‘parent’ template from within a template if you so choose. This works for partials and top-level templates alike.

foo/view.html.erb

<h1>Foo View</h1>

bar/view.html.erb

<%= render :parent %>
<h2>With some 'bar' action</h2>

rendering bar/view (with the controller setup described above):

<h1>Foo View</h1>
<h2>With some 'bar' action</h2>

Testing & CI

RSpec is used for testing, so the tests are in spec/ rather than test/ Do rake –tasks for more details.

garlic is used for CI, see garlic.rb for details on what versions of rails are tested.

Contributors

Author: Ian W. White

Contributions by:

inherit_views's People

Contributors

ianwhite avatar michaeldeitcher avatar rst avatar

Stargazers

 avatar

Watchers

 avatar  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.