[READ-ONLY] Mirror of https://github.com/shuuji3/rails-tutorial-sample-app.
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1 from shuuji3/static-pages

Create static-pages.

+93 -4
+3
app/assets/javascripts/static_pages.coffee
··· 1 + # Place all the behaviors and hooks related to the matching controller here. 2 + # All this logic will automatically be available in application.js. 3 + # You can use CoffeeScript in this file: http://coffeescript.org/
+3
app/assets/stylesheets/static_pages.scss
··· 1 + // Place all the styles related to the StaticPages controller here. 2 + // They will automatically be included in application.css. 3 + // You can use Sass (SCSS) here: http://sass-lang.com/
+10
app/controllers/static_pages_controller.rb
··· 1 + class StaticPagesController < ApplicationController 2 + def home 3 + end 4 + 5 + def help 6 + end 7 + 8 + def about 9 + end 10 + end
+2
app/helpers/static_pages_helper.rb
··· 1 + module StaticPagesHelper 2 + end
+2 -3
app/views/layouts/application.html.erb
··· 1 1 <!DOCTYPE html> 2 2 <html> 3 3 <head> 4 - <title>SampleApp</title> 4 + <title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title> 5 5 <%= csrf_meta_tags %> 6 - 7 - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 6 + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 8 7 <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 9 8 </head> 10 9
+10
app/views/static_pages/about.html.erb
··· 1 + <% provide(:title, "About") %> 2 + <h1>About</h1> 3 + <p> 4 + <a href="https://railstutorial.jp/">Ruby on Rails Tutorial</a> 5 + is a <a href="https://railstutorial.jp/#ebook">book</a> and 6 + <a href="https://railstutorial.jp/#screencast">screencast</a> 7 + to teach web development with 8 + <a href="http://rubyonrails.org/">Ruby on Rails</a>. 9 + This is the sample application for the tutorial. 10 + </p>
+9
app/views/static_pages/help.html.erb
··· 1 + <% provide(:title, "Help") %> 2 + <h1>Help</h1> 3 + <p> Get help on the Ruby on Rails Tutorial at the 4 + <a href="https://railstutorial.jp/help">Rails Tutorial help 5 + page</a>. 6 + To get help on this sample app, see the 7 + <a href="https://railstutorial.jp/#ebook"> 8 + <em>Ruby on Rails Tutorial</em> book</a>. 9 + </p>
+7
app/views/static_pages/home.html.erb
··· 1 + <% provide(:title, "Home") %> 2 + <h1>Sample App</h1> 3 + <p> 4 + This is the home page for the 5 + <a href="https://railstutorial.jp/">Ruby on Rails Tutorial</a> 6 + sample application. 7 + </p>
+5 -1
config/routes.rb
··· 1 1 Rails.application.routes.draw do 2 + get 'static_pages/home' 3 + get 'static_pages/help' 4 + get 'static_pages/about' 5 + 2 6 # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 3 - root 'application#hello' 7 + root 'static_pages#home' 4 8 end
+15
db/schema.rb
··· 1 + # This file is auto-generated from the current state of the database. Instead 2 + # of editing this file, please use the migrations feature of Active Record to 3 + # incrementally modify your database, and then regenerate this schema definition. 4 + # 5 + # Note that this schema.rb definition is the authoritative source for your 6 + # database schema. If you need to create the application database on another 7 + # system, you should be using db:schema:load, not running all the migrations 8 + # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 + # you'll amass, the slower it'll run and the greater likelihood for issues). 10 + # 11 + # It's strongly recommended that you check this file into your version control system. 12 + 13 + ActiveRecord::Schema.define(version: 0) do 14 + 15 + end
+25
test/controllers/static_pages_controller_test.rb
··· 1 + require 'test_helper' 2 + 3 + class StaticPagesControllerTest < ActionDispatch::IntegrationTest 4 + def setup 5 + @base_title = "Ruby on Rails Tutorial Sample App" 6 + end 7 + 8 + test "should get home" do 9 + get static_pages_home_url 10 + assert_response :success 11 + assert_select "title", "Home | #{@base_title}" 12 + end 13 + 14 + test "should get help" do 15 + get static_pages_help_url 16 + assert_response :success 17 + assert_select "title", "Help | #{@base_title}" 18 + end 19 + 20 + test 'should get about' do 21 + get static_pages_about_url 22 + assert_response :success 23 + assert_select "title", "About | #{@base_title}" 24 + end 25 + end
+2
test/test_helper.rb
··· 1 1 ENV['RAILS_ENV'] ||= 'test' 2 2 require File.expand_path('../../config/environment', __FILE__) 3 3 require 'rails/test_help' 4 + require "minitest/reporters" 5 + Minitest::Reporters.use! 4 6 5 7 class ActiveSupport::TestCase 6 8 # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.