Commit cf5ee72e by Son Do Hong

Merge branch 'filling-in-layout' into 'master'

Filling in layout

See merge request !4
parents 9472d3c8 196dcd1b
source 'https://rubygems.org' source "https://rubygems.org"
gem 'rails', '5.1.6' gem "rails", "5.1.6"
gem 'puma', '3.9.1' gem "bootstrap-sass", "3.3.7"
gem 'sass-rails', '5.0.6' gem "puma", "3.9.1"
gem 'uglifier', '3.2.0' gem "sass-rails", "5.0.6"
gem 'coffee-rails', '4.2.2' gem "uglifier", "3.2.0"
gem 'jquery-rails', '4.3.1' gem "coffee-rails", "4.2.2"
gem 'turbolinks', '5.0.1' gem "jquery-rails", "4.3.1"
gem 'jbuilder', '2.7.0' gem "turbolinks", "5.0.1"
gem "jbuilder", "2.7.0"
group :development, :test do group :development, :test do
gem 'sqlite3', '1.3.13' gem "sqlite3", "1.3.13"
gem 'byebug', '9.0.6', platform: :mri gem "byebug", "9.0.6", platform: :mri
end end
group :development do group :development do
gem 'web-console', '3.5.1' gem "web-console", "3.5.1"
gem 'listen', '3.1.5' gem "listen", "3.1.5"
gem 'spring', '2.0.2' gem "spring", "2.0.2"
gem 'spring-watcher-listen', '2.0.1' gem "spring-watcher-listen", "2.0.1"
end end
group :test do group :test do
gem 'rails-controller-testing', '1.0.2' gem "rails-controller-testing", "1.0.2"
gem 'minitest', '5.10.3' gem "minitest", "5.10.3"
gem 'minitest-reporters', '1.1.14' gem "minitest-reporters", "1.1.14"
gem 'guard', '2.13.0' gem "guard", "2.13.0"
gem 'guard-minitest', '2.4.4' gem "guard-minitest", "2.4.4"
end end
group :production do group :production do
gem 'pg', '0.20.0' gem "pg", "0.20.0"
end end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
\ No newline at end of file
...@@ -40,7 +40,12 @@ GEM ...@@ -40,7 +40,12 @@ GEM
tzinfo (~> 1.1) tzinfo (~> 1.1)
ansi (1.5.0) ansi (1.5.0)
arel (8.0.0) arel (8.0.0)
autoprefixer-rails (9.7.1)
execjs
bindex (0.8.1) bindex (0.8.1)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.3) builder (3.2.3)
byebug (9.0.6) byebug (9.0.6)
coderay (1.1.2) coderay (1.1.2)
...@@ -197,6 +202,7 @@ PLATFORMS ...@@ -197,6 +202,7 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
bootstrap-sass (= 3.3.7)
byebug (= 9.0.6) byebug (= 9.0.6)
coffee-rails (= 4.2.2) coffee-rails (= 4.2.2)
guard (= 2.13.0) guard (= 2.13.0)
......
# 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://coffeescript.org/
@import "bootstrap-sprockets";
@import "bootstrap";
/* mixins, variables, etc. */
$gray-medium-light: #eaeaea;
/* universal */
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
/* typography */
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}
h2 {
font-size: 1.2em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $gray-light;
}
p {
font-size: 1.1em;
line-height: 1.7em;
}
/* header */
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: white;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
&:hover {
color: white;
text-decoration: none;
}
}
/* footer */
footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $gray-medium-light;
color: $gray-light;
a {
color: $gray;
&:hover {
color: $gray-darker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 15px;
}
}
}
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class UsersController < ApplicationController
def new
end
end
module UsersHelper
end
<footer class="footer">
<small>
The <a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
by <a href="http://www.michaelhartl.com/">Michael Hartl</a>
</small>
<nav>
<ul>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
<li><a href="http://news.railstutorial.org/">News</a></li>
</ul>
</nav>
</footer>
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "sample app", root_path, id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", help_path %></li>
<li><%= link_to "Log in", '#' %></li>
</ul>
</nav>
</div>
</header>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">
</script>
<![endif]-->
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">
</script> </script>
<![endif]--> <![endif]-->
<%= render "layouts/shim" %>
</head> </head>
<body> <body>
<header class="navbar navbar-fixed-top navbar-inverse"> <header class="navbar navbar-fixed-top navbar-inverse">
<%= render 'layouts/header' %>
<div class="container"> <div class="container">
<%= link_to "sample app", "#", id: "logo" %> <%= link_to "sample app", "#", id: "logo" %>
<nav> <nav>
...@@ -26,6 +28,7 @@ ...@@ -26,6 +28,7 @@
</header> </header>
<div class="container"> <div class="container">
<%= yield %> <%= yield %>
<%= render "layouts/footer" %>
</div> </div>
</body> </body>
</html> </html>
<h1>Sample App</h1> <div class="center jumbotron">
<p> <h1>Welcome to the Sample App</h1>
<h2>
This is the home page for the This is the home page for the
<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a> <a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application. sample application.
</p> </h2>
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>
</div>
<%= link_to image_tag("rails.png", alt: "Rails logo"),
'http://rubyonrails.org/' %>
<% provide(:title, "Sign up") %>
<h1>Sign up</h1>
<p>This will be a signup page for new users.</p>
Rails.application.routes.draw do 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 "static_pages#home" root "static_pages#home"
get "/help", to: "static_pages#help"
get "/about", to: "static_pages#about"
get "/contact", to: "static_pages#contact"
get "/signup", to: "users#new"
end end
require "test_helper" require "test_helper"
class StaticPagesControllerTest < ActionDispatch::IntegrationTest class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get home" do test "should get home" do
get static_pages_home_url get root_path
assert_response :success assert_response :success
assert_select "title", "Ruby on Rails Tutorial Sample App" assert_select "title", "Ruby on Rails Tutorial Sample App"
end end
test "should get help" do test "should get help" do
get static_pages_help_url get help_path
assert_response :success assert_response :success
assert_select "title", "Help | Ruby on Rails Tutorial Sample App" assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
end end
test "should get about" do test "should get about" do
get static_pages_about_url get about_path
assert_response :success assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App" assert_select "title", "About | Ruby on Rails Tutorial Sample App"
end end
test "should get contact" do
get contact_path
assert_response :success
assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
end
test "should get signup" do
get signup_path
assert_response :success
end
end end
require "test_helper"
class UsersControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get signup_path
assert_response :success
end
end
require "test_helper"
class SiteLayoutTest < ActionDispatch::IntegrationTest
test "layout links" do
get root_path
assert_template "static_pages/home"
assert_select "a[href=?]", root_path, count: 2
assert_select "a[href=?]", help_path
assert_select "a[href=?]", about_path
assert_select "a[href=?]", contact_path
get contact_path
assert_select "title", full_title("Contact")
end
end
ENV['RAILS_ENV'] ||= 'test' ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__) require File.expand_path("../../config/environment", __FILE__)
require 'rails/test_help' require "rails/test_help"
class ActiveSupport::TestCase class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all fixtures :all
include ApplicationHelper
# Add more helper methods to be used by all tests here... # Add more helper methods to be used by all tests here...
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