Skip to content
Browse files

Finished Static Pages

  • Loading branch information...
1 parent aed0aab commit 0952a6011ba46baac42525cd364f9fa864de4db0 @tadinve committed Mar 10, 2012
View
3 app/assets/javascripts/static_pages.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
View
3 app/assets/stylesheets/static_pages.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the StaticPages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
10 app/controllers/static_pages_controller.rb
@@ -0,0 +1,10 @@
+class StaticPagesController < ApplicationController
+ def home
+ end
+
+ def help
+ end
+
+ def about
+ end
+end
View
7 app/controllers/static_pages_controller.rb~
@@ -0,0 +1,7 @@
+class StaticPagesController < ApplicationController
+ def home
+ end
+
+ def help
+ end
+end
View
2 app/helpers/static_pages_helper.rb
@@ -0,0 +1,2 @@
+module StaticPagesHelper
+end
View
2 app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Sap4</title>
+ <title>My Tutorial 4 | <%= yield(:title) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
View
14 app/views/layouts/application.html.erb~
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Sap4</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
View
8 app/views/static_pages/about.html.erb
@@ -0,0 +1,8 @@
+<% provide(:title, 'About Us') %>
+ <h1>About Us</h1>
+ <p>
+ This is the About page for my application.
+ </p
+
+
+
View
9 app/views/static_pages/about.html.erb~
@@ -0,0 +1,9 @@
+<% provide(:title, 'About Us') %>
+<!DOCTYPE html>
+ <h1>About Us</h1>
+ <p>
+ This is the About page for my application.
+ </p
+
+
+
View
8 app/views/static_pages/help.html.erb
@@ -0,0 +1,8 @@
+<% provide(:title, 'Help') %>
+ <h1>Help</h1>
+ <p>
+ This is the help page for my application.
+ </p>
+
+
+
View
15 app/views/static_pages/help.html.erb~
@@ -0,0 +1,15 @@
+<% provide(:title, 'Help') %>
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Tutorial | <%= yield(:title) %> </title>
+<head>
+<body>
+ <h1>Help</h1>
+ <p>
+ This is the help page for my application.
+ </p>
+</body>
+</html>
+
+
View
7 app/views/static_pages/home.html.erb
@@ -0,0 +1,7 @@
+<% provide(:title, 'Home') %>
+ <h1>Sample App</h1>
+ <p>
+ This is the home for my application built by
+ <a href="http://google.com"> Venkat </a>
+ </p>
+
View
13 app/views/static_pages/home.html.erb~
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Tutorial | Home </title>
+<head>
+<body>
+ <h1>Sample App</h1>
+ <p>
+ This is the home for my application built by
+ <a href="http://google.com"> Venkat </a>
+ </p>
+</body>
+</html>
View
58 config/routes.rb
@@ -1,58 +1,8 @@
Sap4::Application.routes.draw do
- # The priority is based upon order of creation:
- # first created -> highest priority.
+ get "static_pages/home"
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
+ get "static_pages/help"
+ get "static_pages/about"
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
-
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
- # root :to => 'welcome#index'
-
- # See how all your routes lay out with "rake routes"
-
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id))(.:format)'
+ match '/home' => 'static_pages#home'
end
View
7 config/routes.rb~
@@ -0,0 +1,7 @@
+Sap4::Application.routes.draw do
+ get "static_pages/home"
+
+ get "static_pages/help"
+
+ match '/home' => 'static_pages#home'
+end
View
46 spec/requests/static_pages_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe "Static pages" do
+
+ describe "Home page" do
+
+ it "should have the h1 'Sample App'" do
+ visit '/static_pages/home'
+ page.should have_selector('h1', :text => 'Sample App')
+ end
+
+ it "should have the title 'Home'" do
+ visit '/static_pages/home'
+ page.should have_selector('title',
+ :text => " | Home")
+ end
+ end
+
+ describe "Help page" do
+
+ it "should have the h1 'Help'" do
+ visit '/static_pages/help'
+ page.should have_selector('h1', :text => 'Help')
+ end
+
+ it "should have the title 'Help'" do
+ visit '/static_pages/help'
+ page.should have_selector('title',
+ :text => " | Help")
+ end
+ end
+
+ describe "About page" do
+
+ it "should have the h1 'About'" do
+ visit '/static_pages/about'
+ page.should have_selector('h1', :text => 'About Us')
+ end
+
+ it "should have the title 'About Us'" do
+ visit '/static_pages/about'
+ page.should have_selector('title',
+ :text => " | About Us")
+ end
+ end
+end
View
46 spec/requests/static_pages_spec.rb~
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe "Static pages" do
+
+ describe "Home page" do
+
+ it "should have the h1 'Sample App'" do
+ visit '/static_pages/home'
+ page.should have_selector('h1', :text => 'Sample App')
+ end
+
+ it "should have the title 'Home'" do
+ visit '/static_pages/home'
+ page.should have_selector('title',
+ :text => " | Home")
+ end
+ end
+
+ describe "Help page" do
+
+ it "should have the h1 'Help'" do
+ visit '/static_pages/help'
+ page.should have_selector('h1', :text => 'Help')
+ end
+
+ it "should have the title 'Help'" do
+ visit '/static_pages/help'
+ page.should have_selector('title',
+ :text => "Ruby on Rails Tutorial Sample App | Help")
+ end
+ end
+
+ describe "About page" do
+
+ it "should have the h1 'About'" do
+ visit '/static_pages/about'
+ page.should have_selector('h1', :text => 'About Us')
+ end
+
+ it "should have the title 'About Us'" do
+ visit '/static_pages/about'
+ page.should have_selector('title',
+ :text => "Ruby on Rails Tutorial Sample App | About Us")
+ end
+ end
+end

0 comments on commit 0952a60

Please sign in to comment.
Something went wrong with that request. Please try again.