This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 13bb9c75611938f3f1a6636ddcd1e270ee8fc1fd
tree 88809e2b88e4f656384b554b7fba8c43ed600bdb
parent 5282cb6a7b6db2bd14ef938c3e64ec4c9fb7c2c1
tree 88809e2b88e4f656384b554b7fba8c43ed600bdb
parent 5282cb6a7b6db2bd14ef938c3e64ec4c9fb7c2c1
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Jul 24 13:00:12 -0700 2009 | |
| |
MIT-LICENSE | Tue Apr 21 12:56:12 -0700 2009 | |
| |
README.markdown | Fri Jul 24 15:39:55 -0700 2009 | |
| |
Rakefile | Tue Apr 21 12:56:12 -0700 2009 | |
| |
app/ | Fri Jul 24 13:00:12 -0700 2009 | |
| |
config/ | Fri Jul 24 13:00:12 -0700 2009 | |
| |
init.rb | Fri Jul 24 13:00:12 -0700 2009 | |
| |
install.rb | Tue Apr 21 12:56:12 -0700 2009 | |
| |
lib/ | Fri Jul 24 13:00:12 -0700 2009 | |
| |
tasks/ | Tue Apr 21 12:56:12 -0700 2009 | |
| |
test/ | Fri Jul 24 13:00:12 -0700 2009 | |
| |
uninstall.rb | Tue Apr 21 12:56:12 -0700 2009 |
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
Enjoy!
Copyright (c) 2009 Thoughtbot, released under the MIT license







