github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

ianwhite / inherit_views

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 19
    • 3
  • Source
  • Commits
  • Network (3)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (5)
    • gems
    • gh-pages
    • master ✓
    • rails-2.0-2.1
    • rails-2.2
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

rails plugin that enables inheritance of views along a controller class heirachy — Read more

  cancel

http://ianwhite.github.com/inherit_views

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Updated rails version in readme 
ianwhite (author)
Tue Apr 07 03:50:41 -0700 2009
commit  cb020e3185d97156c06b593364af4f15e78948c8
tree    13cdd94a19cf7dc9b3b692e69c5e4479fe1dd447
parent  24bb9b75f3525a9f44d21928649cf5435bebe410
inherit_views /
name age
history
message
file .gitignore Thu Nov 20 00:15:17 -0800 2008 Updated CI to use new garlic gem stylee [ianwhite]
file History.txt Sat Feb 07 11:10:05 -0800 2009 Added ActionMailer support for inherit_views [ianwhite]
file License.txt Loading commit data...
file README.rdoc
file Rakefile
file Todo.txt
file garlic.rb
file init.rb
directory lib/ Tue Mar 03 01:29:09 -0800 2009 Update method signature of find_template to mat... [ianwhite]
directory spec/ Mon Feb 09 05:00:43 -0800 2009 Spec for when render(:parent) called when no pa... [ianwhite]
README.rdoc

ianwhite / inherit_views >>info >>api

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:

  • The Dark One
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server