Permalink
Browse files

adding episode 117

  • Loading branch information...
1 parent 52c9fd5 commit 9ed7ed4c27bc72dea51c4f5f53641fb2b239074e @ryanb committed Jul 7, 2008
Showing with 8,683 additions and 0 deletions.
  1. +7 −0 episode-117/README
  2. +3 −0 episode-117/store/.gitignore
  3. +4 −0 episode-117/store/README
  4. +10 −0 episode-117/store/Rakefile
  5. +15 −0 episode-117/store/app/controllers/application.rb
  6. +44 −0 episode-117/store/app/controllers/categories_controller.rb
  7. +10 −0 episode-117/store/app/controllers/info_controller.rb
  8. +49 −0 episode-117/store/app/controllers/pages_controller.rb
  9. +44 −0 episode-117/store/app/controllers/products_controller.rb
  10. +3 −0 episode-117/store/app/helpers/application_helper.rb
  11. +2 −0 episode-117/store/app/helpers/categories_helper.rb
  12. +2 −0 episode-117/store/app/helpers/info_helper.rb
  13. +23 −0 episode-117/store/app/helpers/layout_helper.rb
  14. +3 −0 episode-117/store/app/helpers/pages_helper.rb
  15. +2 −0 episode-117/store/app/helpers/products_helper.rb
  16. +3 −0 episode-117/store/app/models/category.rb
  17. +3 −0 episode-117/store/app/models/page.rb
  18. +3 −0 episode-117/store/app/models/product.rb
  19. +7 −0 episode-117/store/app/views/categories/_form.html.erb
  20. +8 −0 episode-117/store/app/views/categories/edit.html.erb
  21. +13 −0 episode-117/store/app/views/categories/index.html.erb
  22. +5 −0 episode-117/store/app/views/categories/new.html.erb
  23. +13 −0 episode-117/store/app/views/categories/show.html.erb
  24. +9 −0 episode-117/store/app/views/info/about.html.erb
  25. +11 −0 episode-117/store/app/views/info/contact.html.erb
  26. +11 −0 episode-117/store/app/views/info/license.html.erb
  27. +11 −0 episode-117/store/app/views/info/privacy.html.erb
  28. +22 −0 episode-117/store/app/views/layouts/application.html.erb
  29. +15 −0 episode-117/store/app/views/pages/_form.html.erb
  30. +8 −0 episode-117/store/app/views/pages/edit.html.erb
  31. +21 −0 episode-117/store/app/views/pages/index.html.erb
  32. +5 −0 episode-117/store/app/views/pages/new.html.erb
  33. +9 −0 episode-117/store/app/views/pages/show.html.erb
  34. +19 −0 episode-117/store/app/views/products/_form.html.erb
  35. +8 −0 episode-117/store/app/views/products/edit.html.erb
  36. +16 −0 episode-117/store/app/views/products/index.html.erb
  37. +5 −0 episode-117/store/app/views/products/new.html.erb
  38. +21 −0 episode-117/store/app/views/products/show.html.erb
  39. +109 −0 episode-117/store/config/boot.rb
  40. +19 −0 episode-117/store/config/database.yml
  41. +69 −0 episode-117/store/config/environment.rb
  42. +17 −0 episode-117/store/config/environments/development.rb
  43. +22 −0 episode-117/store/config/environments/production.rb
  44. +22 −0 episode-117/store/config/environments/test.rb
  45. +10 −0 episode-117/store/config/initializers/inflections.rb
  46. +5 −0 episode-117/store/config/initializers/mime_types.rb
  47. +15 −0 episode-117/store/config/initializers/new_rails_defaults.rb
  48. +16 −0 episode-117/store/config/routes.rb
  49. +12 −0 episode-117/store/db/migrate/20080621194238_create_categories.rb
  50. +15 −0 episode-117/store/db/migrate/20080621194423_create_products.rb
  51. +14 −0 episode-117/store/db/migrate/20080707044755_create_pages.rb
  52. +37 −0 episode-117/store/db/schema.rb
  53. +22 −0 episode-117/store/lib/tasks/application.rake
  54. +30 −0 episode-117/store/public/404.html
  55. +30 −0 episode-117/store/public/422.html
  56. +30 −0 episode-117/store/public/500.html
  57. +10 −0 episode-117/store/public/dispatch.cgi
  58. +24 −0 episode-117/store/public/dispatch.fcgi
  59. +10 −0 episode-117/store/public/dispatch.rb
  60. 0 episode-117/store/public/favicon.ico
  61. +2 −0 episode-117/store/public/javascripts/application.js
  62. +963 −0 episode-117/store/public/javascripts/controls.js
  63. +972 −0 episode-117/store/public/javascripts/dragdrop.js
  64. +1,120 −0 episode-117/store/public/javascripts/effects.js
  65. +4,225 −0 episode-117/store/public/javascripts/prototype.js
  66. +5 −0 episode-117/store/public/robots.txt
  67. +92 −0 episode-117/store/public/stylesheets/application.css
  68. +3 −0 episode-117/store/script/about
  69. +3 −0 episode-117/store/script/console
  70. +3 −0 episode-117/store/script/dbconsole
  71. +3 −0 episode-117/store/script/destroy
  72. +3 −0 episode-117/store/script/generate
  73. +3 −0 episode-117/store/script/performance/benchmarker
  74. +3 −0 episode-117/store/script/performance/profiler
  75. +3 −0 episode-117/store/script/performance/request
  76. +3 −0 episode-117/store/script/plugin
  77. +3 −0 episode-117/store/script/process/inspector
  78. +3 −0 episode-117/store/script/process/reaper
  79. +3 −0 episode-117/store/script/process/spawner
  80. +3 −0 episode-117/store/script/runner
  81. +3 −0 episode-117/store/script/server
  82. +5 −0 episode-117/store/test/fixtures/categories.yml
  83. +9 −0 episode-117/store/test/fixtures/pages.yml
  84. +11 −0 episode-117/store/test/fixtures/products.yml
  85. +54 −0 episode-117/store/test/functional/categories_controller_test.rb
  86. +8 −0 episode-117/store/test/functional/info_controller_test.rb
  87. +54 −0 episode-117/store/test/functional/pages_controller_test.rb
  88. +54 −0 episode-117/store/test/functional/products_controller_test.rb
  89. +38 −0 episode-117/store/test/test_helper.rb
  90. +8 −0 episode-117/store/test/unit/category_test.rb
  91. +8 −0 episode-117/store/test/unit/page_test.rb
  92. +8 −0 episode-117/store/test/unit/product_test.rb
  93. 0 episode-117/store/vendor/plugins/.gitignore
View
@@ -0,0 +1,7 @@
+Railscasts Episode #117: Semi-Static Pages
+
+http://railscasts.com/episodes/117
+
+Commands
+
+ sudo gem install RedCloth --source=http://code.whytheluckystiff.net
@@ -0,0 +1,3 @@
+tmp/*
+log/*
+*.sqlite3
@@ -0,0 +1,4 @@
+Railscasts Example Store App
+--
+
+To setup the app, just run `rake setup`.
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
@@ -0,0 +1,15 @@
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+class ApplicationController < ActionController::Base
+ helper :all # include all helpers, all the time
+
+ # See ActionController::RequestForgeryProtection for details
+ # Uncomment the :secret if you're not using the cookie session store
+ protect_from_forgery # :secret => '526292d4095d0fd8135a9aa118f5956e'
+
+ # See ActionController::Base for details
+ # Uncomment this to filter the contents of submitted sensitive data parameters
+ # from your application log (in this case, all fields with names like "password").
+ # filter_parameter_logging :password
+end
@@ -0,0 +1,44 @@
+class CategoriesController < ApplicationController
+ def index
+ @categories = Category.find(:all)
+ end
+
+ def show
+ @category = Category.find(params[:id])
+ end
+
+ def new
+ @category = Category.new
+ end
+
+ def create
+ @category = Category.new(params[:category])
+ if @category.save
+ flash[:notice] = "Successfully created category."
+ redirect_to @category
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @category = Category.find(params[:id])
+ end
+
+ def update
+ @category = Category.find(params[:id])
+ if @category.update_attributes(params[:category])
+ flash[:notice] = "Successfully updated category."
+ redirect_to @category
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ @category = Category.find(params[:id])
+ @category.destroy
+ flash[:notice] = "Successfully destroyed category."
+ redirect_to categories_url
+ end
+end
@@ -0,0 +1,10 @@
+class InfoController < ApplicationController
+ def about
+ end
+
+ def contact
+ end
+
+ def privacy
+ end
+end
@@ -0,0 +1,49 @@
+class PagesController < ApplicationController
+ def index
+ @pages = Page.find(:all)
+ end
+
+ def show
+ if params[:permalink]
+ @page = Page.find_by_permalink(params[:permalink])
+ raise ActiveRecord::RecordNotFound, "Page not found" if @page.nil?
+ else
+ @page = Page.find(params[:id])
+ end
+ end
+
+ def new
+ @page = Page.new
+ end
+
+ def create
+ @page = Page.new(params[:page])
+ if @page.save
+ flash[:notice] = "Successfully created page."
+ redirect_to @page
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @page = Page.find(params[:id])
+ end
+
+ def update
+ @page = Page.find(params[:id])
+ if @page.update_attributes(params[:page])
+ flash[:notice] = "Successfully updated page."
+ redirect_to @page
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ @page = Page.find(params[:id])
+ @page.destroy
+ flash[:notice] = "Successfully destroyed page."
+ redirect_to pages_path
+ end
+end
@@ -0,0 +1,44 @@
+class ProductsController < ApplicationController
+ def index
+ @products = Product.all(:limit => 10)
+ end
+
+ def show
+ @product = Product.find(params[:id])
+ end
+
+ def new
+ @product = Product.new
+ end
+
+ def create
+ @product = Product.new(params[:product])
+ if @product.save
+ flash[:notice] = "Successfully created product."
+ redirect_to @product
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @product = Product.find(params[:id])
+ end
+
+ def update
+ @product = Product.find(params[:id])
+ if @product.update_attributes(params[:product])
+ flash[:notice] = "Successfully updated product."
+ redirect_to @product
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ @product = Product.find(params[:id])
+ @product.destroy
+ flash[:notice] = "Successfully destroyed product."
+ redirect_to products_url
+ end
+end
@@ -0,0 +1,3 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+end
@@ -0,0 +1,2 @@
+module CategoriesHelper
+end
@@ -0,0 +1,2 @@
+module InfoHelper
+end
@@ -0,0 +1,23 @@
+# These helper methods can be called in your template to set variables to be used in the layout
+# This module should be included in all views globally,
+# to do so you may need to add this line to your ApplicationController
+# helper :layout
+module LayoutHelper
+ def title(page_title, show_title = true)
+ @content_for_title = page_title.to_s
+ @show_title = show_title
+ end
+
+ def show_title?
+ @show_title
+ end
+
+ def stylesheet(*args)
+ content_for(:head) { stylesheet_link_tag(*args.map(&:to_s)) }
+ end
+
+ def javascript(*args)
+ args = args.map { |arg| arg == :defaults ? arg : arg.to_s }
+ content_for(:head) { javascript_include_tag(*args) }
+ end
+end
@@ -0,0 +1,3 @@
+module PagesHelper
+
+end
@@ -0,0 +1,2 @@
+module ProductsHelper
+end
@@ -0,0 +1,3 @@
+class Category < ActiveRecord::Base
+ has_many :products
+end
@@ -0,0 +1,3 @@
+class Page < ActiveRecord::Base
+
+end
@@ -0,0 +1,3 @@
+class Product < ActiveRecord::Base
+ belongs_to :category
+end
@@ -0,0 +1,7 @@
+<% form_for @category do |f| %>
+ <p>
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </p>
+ <p><%= f.submit "Submit" %></p>
+<% end %>
@@ -0,0 +1,8 @@
+<% title "Edit Category" %>
+
+<%= render :partial => 'form' %>
+
+<p>
+ <%= link_to "Show", @category %> |
+ <%= link_to "View All", categories_path %>
+</p>
@@ -0,0 +1,13 @@
+<% title "Categories" %>
+
+<% for category in @categories %>
+ <div class="category">
+ <h3><%= link_to h(category.name), category %></h3>
+ <div class="actions">
+ <%= link_to "Edit", edit_category_path(category) %> |
+ <%= link_to "Destroy", category, :confirm => 'Are you sure?', :method => :delete %>
+ </div>
+ </div>
+<% end %>
+
+<p><%= link_to "New Category", new_category_path %></p>
@@ -0,0 +1,5 @@
+<% title "New Category" %>
+
+<%= render :partial => 'form' %>
+
+<p><%= link_to "Back to List", categories_path %></p>
@@ -0,0 +1,13 @@
+<% title @category.name %>
+
+<ul>
+<% for product in @category.products %>
+ <li><%= link_to h(product.name), product %></li>
+<% end %>
+</ul>
+
+<p>
+ <%= link_to "Edit", edit_category_path(@category) %> |
+ <%= link_to "Destroy", @category, :confirm => 'Are you sure?', :method => :delete %> |
+ <%= link_to "View All", categories_path %>
+</p>
@@ -0,0 +1,9 @@
+<% title "About Us" %>
+
+<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
+
+<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+
+<p>Aenean sapien purus, porttitor non, vulputate eget, consequatsed, lorem. Sed molestie mauris eget libero. Integer aliquam magna sed dolor.Integer sem felis, egestas at, tempor quis, tincidunt at, velit. Cras neque. Quisque sed augue.</p>
+
+<p>Sed consectetuer posuere turpis. Aliquam erat volutpat. Prointellus. Sed eget metus. Donec sapien justo, varius at, adipiscing quis, euismodsed, orci. Quisque vel pede non dui adipiscing ullamcorper. Nulla facilisi. Fusce sapien.</p>
@@ -0,0 +1,11 @@
+<% title "Contact Information" %>
+
+<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce ut lorem id arcufaucibus porta. Integer imperdiet nunc ut dui. Nam a purus. Ut scelerisqueporttitor velit. Aenean sapien purus, porttitor non, vulputate eget, consequatsed, lorem. Sed molestie mauris eget libero. Integer aliquam magna sed dolor.Integer sem felis, egestas at, tempor quis, tincidunt at, velit. Cras neque.Quisque sed augue. Sed consectetuer posuere turpis. Aliquam erat volutpat. Prointellus. Sed eget metus. Donec sapien justo, varius at, adipiscing quis, euismodsed, orci. Quisque vel pede non dui adipiscing ullamcorper. Nulla facilisi.Fusce sapien.</p>
+
+<p>Ut nisi leo, vestibulum nec, fringilla vitae, feugiat at, lectus. Donecfringilla pretium orci. Fusce pharetra facilisis odio. Donec eget elit. Nullaeget libero ac lectus mollis feugiat. Phasellus tincidunt orci at elit. Maecenasnon ipsum. Sed fringilla. Donec ac pede. Class aptent taciti sociosqu ad litoratorquent per conubia nostra, per inceptos hymenaeos. Phasellus ac nibh.Pellentesque non dolor.</p>
+
+<p>Nullam est. Suspendisse faucibus, urna in auctor mollis, eros libero laciniametus, ut pharetra eros augue eu ligula. Nulla aliquam. Sed vitae leo. Sed acante. Quisque auctor feugiat leo. Nullam placerat nunc ut erat. Fusce orcilacus, vulputate ut, tincidunt eu, rhoncus ac, lorem. Phasellus non diam.Pellentesque eu risus.</p>
+
+<p>Nam at magna a mi lacinia scelerisque. Vestibulum erat massa, venenatis at,facilisis vel, gravida et, orci. Integer blandit ultricies ligula. Morbipellentesque euismod nisl. Aliquam quis tortor tristique purus temporpellentesque. Sed tincidunt dapibus sem. Pellentesque lorem dolor, molestie ac,elementum sed, consequat eget, mi. Sed malesuada aliquam dolor. Vestibulumsapien. Quisque ut erat. Quisque in augue. Pellentesque rutrum pharetra pede.</p>
+
+<p>Sed cursus, nunc vitae pellentesque luctus, leo ligula convallis turpis, necposuere lorem purus eget justo. Aliquam rutrum consectetuer odio. Duis vitaerisus. Quisque tellus magna, tempus semper, luctus sed, varius ut, massa. Nullamnonummy arcu et enim. Suspendisse egestas. In dui metus, bibendum a, tempusquis, suscipit tempor, erat. Proin adipiscing consectetuer justo. Maurisvulputate lacinia magna. Maecenas sit amet justo. Cras porttitor, mi necvolutpat malesuada, justo massa interdum libero, non sollicitudin enim ligulanec dolor. Vivamus et lectus. Praesent non pede. Proin at ligula et ipsumfaucibus condimentum. Fusce ullamcorper tincidunt ipsum. Proin facilisis dui etdolor. Quisque quis magna. Praesent et lacus.</p>
@@ -0,0 +1,11 @@
+<% title "License Agreement" %>
+
+<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce ut lorem id arcufaucibus porta. Integer imperdiet nunc ut dui. Nam a purus. Ut scelerisqueporttitor velit. Aenean sapien purus, porttitor non, vulputate eget, consequatsed, lorem. Sed molestie mauris eget libero. Integer aliquam magna sed dolor.Integer sem felis, egestas at, tempor quis, tincidunt at, velit. Cras neque.Quisque sed augue. Sed consectetuer posuere turpis. Aliquam erat volutpat. Prointellus. Sed eget metus. Donec sapien justo, varius at, adipiscing quis, euismodsed, orci. Quisque vel pede non dui adipiscing ullamcorper. Nulla facilisi.Fusce sapien.</p>
+
+<p>Ut nisi leo, vestibulum nec, fringilla vitae, feugiat at, lectus. Donecfringilla pretium orci. Fusce pharetra facilisis odio. Donec eget elit. Nullaeget libero ac lectus mollis feugiat. Phasellus tincidunt orci at elit. Maecenasnon ipsum. Sed fringilla. Donec ac pede. Class aptent taciti sociosqu ad litoratorquent per conubia nostra, per inceptos hymenaeos. Phasellus ac nibh.Pellentesque non dolor.</p>
+
+<p>Nullam est. Suspendisse faucibus, urna in auctor mollis, eros libero laciniametus, ut pharetra eros augue eu ligula. Nulla aliquam. Sed vitae leo. Sed acante. Quisque auctor feugiat leo. Nullam placerat nunc ut erat. Fusce orcilacus, vulputate ut, tincidunt eu, rhoncus ac, lorem. Phasellus non diam.Pellentesque eu risus.</p>
+
+<p>Nam at magna a mi lacinia scelerisque. Vestibulum erat massa, venenatis at,facilisis vel, gravida et, orci. Integer blandit ultricies ligula. Morbipellentesque euismod nisl. Aliquam quis tortor tristique purus temporpellentesque. Sed tincidunt dapibus sem. Pellentesque lorem dolor, molestie ac,elementum sed, consequat eget, mi. Sed malesuada aliquam dolor. Vestibulumsapien. Quisque ut erat. Quisque in augue. Pellentesque rutrum pharetra pede.</p>
+
+<p>Sed cursus, nunc vitae pellentesque luctus, leo ligula convallis turpis, necposuere lorem purus eget justo. Aliquam rutrum consectetuer odio. Duis vitaerisus. Quisque tellus magna, tempus semper, luctus sed, varius ut, massa. Nullamnonummy arcu et enim. Suspendisse egestas. In dui metus, bibendum a, tempusquis, suscipit tempor, erat. Proin adipiscing consectetuer justo. Maurisvulputate lacinia magna. Maecenas sit amet justo. Cras porttitor, mi necvolutpat malesuada, justo massa interdum libero, non sollicitudin enim ligulanec dolor. Vivamus et lectus. Praesent non pede. Proin at ligula et ipsumfaucibus condimentum. Fusce ullamcorper tincidunt ipsum. Proin facilisis dui etdolor. Quisque quis magna. Praesent et lacus.</p>
@@ -0,0 +1,11 @@
+<% title "Privacy Policy" %>
+
+<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce ut lorem id arcufaucibus porta. Integer imperdiet nunc ut dui. Nam a purus. Ut scelerisqueporttitor velit. Aenean sapien purus, porttitor non, vulputate eget, consequatsed, lorem. Sed molestie mauris eget libero. Integer aliquam magna sed dolor.Integer sem felis, egestas at, tempor quis, tincidunt at, velit. Cras neque.Quisque sed augue. Sed consectetuer posuere turpis. Aliquam erat volutpat. Prointellus. Sed eget metus. Donec sapien justo, varius at, adipiscing quis, euismodsed, orci. Quisque vel pede non dui adipiscing ullamcorper. Nulla facilisi.Fusce sapien.</p>
+
+<p>Ut nisi leo, vestibulum nec, fringilla vitae, feugiat at, lectus. Donecfringilla pretium orci. Fusce pharetra facilisis odio. Donec eget elit. Nullaeget libero ac lectus mollis feugiat. Phasellus tincidunt orci at elit. Maecenasnon ipsum. Sed fringilla. Donec ac pede. Class aptent taciti sociosqu ad litoratorquent per conubia nostra, per inceptos hymenaeos. Phasellus ac nibh.Pellentesque non dolor.</p>
+
+<p>Nullam est. Suspendisse faucibus, urna in auctor mollis, eros libero laciniametus, ut pharetra eros augue eu ligula. Nulla aliquam. Sed vitae leo. Sed acante. Quisque auctor feugiat leo. Nullam placerat nunc ut erat. Fusce orcilacus, vulputate ut, tincidunt eu, rhoncus ac, lorem. Phasellus non diam.Pellentesque eu risus.</p>
+
+<p>Nam at magna a mi lacinia scelerisque. Vestibulum erat massa, venenatis at,facilisis vel, gravida et, orci. Integer blandit ultricies ligula. Morbipellentesque euismod nisl. Aliquam quis tortor tristique purus temporpellentesque. Sed tincidunt dapibus sem. Pellentesque lorem dolor, molestie ac,elementum sed, consequat eget, mi. Sed malesuada aliquam dolor. Vestibulumsapien. Quisque ut erat. Quisque in augue. Pellentesque rutrum pharetra pede.</p>
+
+<p>Sed cursus, nunc vitae pellentesque luctus, leo ligula convallis turpis, necposuere lorem purus eget justo. Aliquam rutrum consectetuer odio. Duis vitaerisus. Quisque tellus magna, tempus semper, luctus sed, varius ut, massa. Nullamnonummy arcu et enim. Suspendisse egestas. In dui metus, bibendum a, tempusquis, suscipit tempor, erat. Proin adipiscing consectetuer justo. Maurisvulputate lacinia magna. Maecenas sit amet justo. Cras porttitor, mi necvolutpat malesuada, justo massa interdum libero, non sollicitudin enim ligulanec dolor. Vivamus et lectus. Praesent non pede. Proin at ligula et ipsumfaucibus condimentum. Fusce ullamcorper tincidunt ipsum. Proin facilisis dui etdolor. Quisque quis magna. Praesent et lacus.</p>
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title><%= h(yield(:title) || "Untitled") %></title>
+ <%= stylesheet_link_tag 'application' %>
+ <%= yield(:head) %>
+ </head>
+ <body>
+ <div id="container">
+ <%- flash.each do |name, msg| -%>
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
+ <%- end -%>
+
+ <%- if show_title? -%>
+ <h1><%=h yield(:title) %></h1>
+ <%- end -%>
+
+ <%= yield %>
+ </div>
+ </body>
+</html>
@@ -0,0 +1,15 @@
+<% form_for @page do |f| %>
+ <p>
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </p>
+ <p>
+ <%= f.label :permalink %><br />
+ <%= f.text_field :permalink %>
+ </p>
+ <p>
+ <%= f.label :content %><br />
+ <%= f.text_area :content %>
+ </p>
+ <p><%= f.submit "Submit" %></p>
+<% end %>
@@ -0,0 +1,8 @@
+<% title "Edit Page" %>
+
+<%= render :partial => 'form' %>
+
+<p>
+ <%= link_to "Show", @page %> |
+ <%= link_to "View All", pages_path %>
+</p>
Oops, something went wrong. Retry.

0 comments on commit 9ed7ed4

Please sign in to comment.