Commit d5001f87 by Đường Sỹ Hoàng

Merge branch 'static-pages' into 'master'

Static pages

See merge request !2
parents 5c56e884 345afc5f
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
def contact
end
end
module StaticPagesHelper
end
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= yield %>
</body>
......
<% provide(:title, "About") %>
<h1>About</h1>
<p>
The <a href="https://www.railstutorial.org/"><em>Ruby on Rails
Tutorial</em></a> is a
<a href="https://www.railstutorial.org/book">book</a> and
<a href="http://screencasts.railstutorial.org/">screencast series</a>
to teach web development with
<a href="http://rubyonrails.org/">Ruby on Rails</a>.
This is the sample application for the tutorial.
</p>
<% provide(:title, "Contact") %>
<h1>Contact</h1>
<p>
Contact the Ruby on Rails Tutorial about the sample app at the
<a href="https://www.railstutorial.org/contact">contact page</a>.
</p>
<% provide(:title, "Help") %>
<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="https://www.railstutorial.org/help">Rails Tutorial help section</a>.
To get help on this sample app, see the
<a href="https://www.railstutorial.org/book"><em>Ruby on Rails Tutorial</em>
book</a>.
</p>
<% provide(:title, "Home") %>
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
Rails.application.routes.draw do
get "static_pages/home"
get "static_pages/help"
get "static_pages/about"
get "static_pages/contact"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'application#hello'
root "static_pages#home"
end
require "test_helper"
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
#test "should get root" do
# get FILL_IN
# assert_response FILL_IN
#end
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
end
test "should get home" do
get static_pages_home_url
assert_response :success
assert_select "title", "Home | #{@base_title}"
end
test "should get help" do
get static_pages_help_url
assert_response :success
assert_select "title", "Help | #{@base_title}"
end
test "should get about" do
get static_pages_about_url
assert_response :success
assert_select "title", "About | #{@base_title}"
end
test "should get contact" do
get static_pages_about_url
assert_response :success
assert_response "title", "Contact | #{@base_title}"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment