Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: itsjan/sample_app
base: 1f1dffef0e
...
head fork: itsjan/sample_app
compare: 94c69d18fd
  • 2 commits
  • 12 files changed
  • 0 commit comments
  • 1 contributor
3  app/assets/javascripts/static_pages.js.coffee
View
@@ -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/
3  app/assets/stylesheets/static_pages.css.scss
View
@@ -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/
11 app/controllers/static_pages_controller.rb
View
@@ -0,0 +1,11 @@
+class StaticPagesController < ApplicationController
+ def home
+ end
+
+ def help
+ end
+
+ def about
+ end
+
+end
2  app/helpers/static_pages_helper.rb
View
@@ -0,0 +1,2 @@
+module StaticPagesHelper
+end
26 app/views/layouts/application.html.erb
View
@@ -1,14 +1,12 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>SampleApp</title>
- <%= stylesheet_link_tag "application", :media => "all" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
-</html>
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+ </head>
+ <body>
+ <%= yield %>
+ </body>
+</html>
8 app/views/static_pages/about.html.erb
View
@@ -0,0 +1,8 @@
+<% provide(:title, 'About Us') %>
+ <h1>About Us</h1>
+ <p>
+ The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ is a project to make a book and screencasts to teach web development
+ with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
+ is the sample application for the tutorial.
+ </p>
8 app/views/static_pages/help.html.erb
View
@@ -0,0 +1,8 @@
+<% provide(:title, 'Help') %>
+ <h1>Help</h1>
+ <p>
+ Get help on the Ruby on Rails Tutorial at the
+ <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
+ To get help on this sample app, see the
+ <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
+ </p>
8 app/views/static_pages/home.html.erb
View
@@ -0,0 +1,8 @@
+<% provide(:title, 'Home') %>
+ <h1>Sample App</h1>
+ <p>
+ This is the home page for the
+ <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ sample application.
+ </p>
+
6 config/routes.rb
View
@@ -1,4 +1,10 @@
SampleApp::Application.routes.draw do
+ get "static_pages/home"
+
+ get "static_pages/help"
+
+ get "static_pages/about"
+
# The priority is based upon order of creation:
# first created -> highest priority.
BIN  gem_graph.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 public/hello.html
View
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Greeting</title>
+ </head>
+ <body>
+ <p>Hello, world!</p>
+ </body>
+</html>
46 spec/requests/static_pages_spec.rb
View
@@ -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 => "Ruby on Rails Tutorial Sample App | 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 Us'" 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

No commit comments for this range

Something went wrong with that request. Please try again.