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

thoughtbot / high_voltage

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

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • 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.

Easily include static pages in your Rails app. — Read more

  cancel

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

This URL has Read+Write access

Add line to README about testing non-custom PagesController. Closes GH-3 
Tristan Dunn (author)
Mon Dec 21 10:24:35 -0800 2009
commit  c82809c42cb060d889b4ca003f64273d7d10a6cb
tree    3119a27f02d8f994f19b6b0a485139f928f00506
parent  13bb9c75611938f3f1a6636ddcd1e270ee8fc1fd
high_voltage /
name age
history
message
file .gitignore Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
file MIT-LICENSE Tue Apr 21 12:56:12 -0700 2009 first commit [tsaleh]
file README.markdown Mon Dec 21 10:24:35 -0800 2009 Add line to README about testing non-custom Pag... [tristandunn]
file Rakefile Tue Apr 21 12:56:12 -0700 2009 first commit [tsaleh]
directory app/ Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
directory config/ Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
file init.rb Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
file install.rb Tue Apr 21 12:56:12 -0700 2009 first commit [tsaleh]
directory lib/ Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
directory tasks/ Tue Apr 21 12:56:12 -0700 2009 first commit [tsaleh]
directory test/ Fri Jul 24 13:00:12 -0700 2009 renamed to high_voltage. namespaced controller ... [Dan Croak]
file uninstall.rb Tue Apr 21 12:56:12 -0700 2009 first commit [tsaleh]
README.markdown

High Voltage

Rails engine for static pages.

... but be careful. Danger!

Static pages?

Yeah, like "About us", "Directions", marketing pages, etc.

Installation

script/plugin install git://github.com/thoughtbot/high_voltage.git

Usage

Write your static pages and put them in the RAILS_ROOT/app/views/pages directory.

mkdir app/views/pages
touch app/views/pages/about.html.erb

After putting something interesting there, you can link to it from anywhere in your app with:

link_to "About", page_path("about")

Bam.

Override

Most common reasons to override? Authentication, layouts.

Create a PagesController of your own:

script/generate controller pages

Then modify it to subclass from High Voltage, adding whatever you need:

class PagesController < HighVoltage::PagesController
  before_filter :authenticate
  layout "danger"
end

Don't forget to add the new route:

map.resources :pages,
  :controller => 'pages',
  :only       => [:show]

Testing

Just a suggestion, but you can test your pages using Shoulda pretty easily:

class PagesControllerTest < ActionController::TestCase
  tests PagesController

  %w(earn_money screencast about contact).each do |page|
    context "on GET to /pages/#{page}" do
      setup { get :show, :id => page }

      should_respond_with :success
      should_render_template page
    end
  end
end

If you're not using a custom PagesController be sure to test HighVoltage::PagesController instead.

Enjoy!

Copyright (c) 2009 Thoughtbot, released under the MIT license

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