Commit 1b9f8c5e by Thanh Hung Pham

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

Filling in layout

See merge request !6
parents c35e7614 b6577f34
Pipeline #1257 failed in 0 seconds
......@@ -2,6 +2,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rexml', '~> 3.2', '>= 3.2.5'
gem 'rails', '6.1.3.2'
gem 'bootstrap', '~> 5.0.1'
gem 'image_processing', '1.9.3'
gem 'mini_magick', '4.9.5'
gem 'active_storage_validations', '0.8.9'
......
......@@ -87,6 +87,10 @@ GEM
bindex (0.8.1)
bootsnap (1.7.2)
msgpack (~> 1.0)
bootstrap (5.0.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 2.9.2, < 3)
sassc-rails (>= 2.0.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
......@@ -163,6 +167,7 @@ GEM
nenv (~> 0.1)
shellany (~> 0.0)
pg (1.2.3)
popper_js (2.9.2)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
......@@ -278,6 +283,7 @@ DEPENDENCIES
aws-sdk-s3 (= 1.87.0)
bcrypt (= 3.1.13)
bootsnap (= 1.7.2)
bootstrap (~> 5.0.1)
bootstrap-sass (= 3.4.1)
bootstrap-will_paginate (= 1.0.0)
byebug (= 11.1.3)
......
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 400 140" enable-background="new 0 0 400 140" xml:space="preserve">
<style>.a{fill:#c00;}</style>
<title>rails-logo</title>
<g>
<path class="a" d="M346.6,121.5v18.1c0,0,23.4,0,32.7,0c6.7,0,18.2-4.9,18.6-18.6c0-0.6,0-6.5,0-7c0-11.7-9.6-18.6-18.6-18.6
c-4.2,0-16.3,0-16.3,0V87l32.3,0V68.8c0,0-22.2,0-31,0c-8,0-18.7,6.6-18.7,18.9c0,1.2,0,5.2,0,6.3c0,12.3,10.6,18.6,18.7,18.6
c22.5,0.1-5.4,0,15.4,0c0,8.8,0,8.8,0,8.8"/>
<path class="a" d="M171.4,117.1c0,0,17.5-1.5,17.5-24.1s-21.2-24.7-21.2-24.7h-38.2v71.3h19.2v-17.2l16.6,17.2h28.4
L171.4,117.1z M164,102.5h-15.3V86.2h15.4c0,0,4.3,1.6,4.3,8.1S164,102.5,164,102.5z"/>
<path class="a" d="M236.3,68.8c-4.9,0-5.6,0-19.5,0c-13.9,0-18.6,12.6-18.6,18.6c0,13,0,52.2,0,52.2h19.5v-12.5H236v12.5h18.9
c0,0,0-38.5,0-52.2C254.9,72.2,241.1,68.8,236.3,68.8z M236,106.9h-18.4V89.6c0,0,0-3.9,6.1-3.9c5.6,0,1,0,6.7,0
c5.4,0,5.5,3.9,5.5,3.9V106.9z"/>
<rect x="263.8" y="68.8" class="a" width="20.3" height="70.8"/>
<polygon class="a" points="312.6,121.3 312.6,68.8 292.4,68.8 292.4,121.3 292.4,139.6 312.6,139.6 339.9,139.6 339.9,121.3
"/>
<path class="a" d="M9,139.6h79c0,0-15.1-68.9,34.9-96.8c10.9-5.3,45.6-25.1,102.4,16.9c1.8-1.5,3.5-2.7,3.5-2.7
S176.8,5.1,118.9,10.9C89.8,13.5,54,40,33,75S9,139.6,9,139.6z"/>
<path class="a" d="M9,139.6h79c0,0-15.1-68.9,34.9-96.8c10.9-5.3,45.6-25.1,102.4,16.9c1.8-1.5,3.5-2.7,3.5-2.7
S176.8,5.1,118.9,10.9C89.8,13.5,54,40,33,75S9,139.6,9,139.6z"/>
<path class="a" d="M9,139.6h79c0,0-15.1-68.9,34.9-96.8c10.9-5.3,45.6-25.1,102.4,16.9c1.8-1.5,3.5-2.7,3.5-2.7
S176.8,5.1,118.9,10.9C89.7,13.5,53.9,40,32.9,75S9,139.6,9,139.6z"/>
<path class="a" d="M173.6,16.5l0.4-6.7c-0.9-0.5-3.4-1.7-9.7-3.5l-0.4,6.6C167.2,14,170.4,15.2,173.6,16.5z"/>
<path class="a" d="M164.1,37.7l-0.4,6.3c3.3,0.1,6.6,0.5,9.9,1.2l0.4-6.2C170.6,38.3,167.3,37.9,164.1,37.7z"/>
<path class="a" d="M127.1,6.5c0.3,0,0.7,0,1,0l-2-6.1c-3.1,0-6.3,0.2-9.6,0.6l1.9,5.9C121.3,6.6,124.2,6.5,127.1,6.5z"/>
<path class="a" d="M131.9,43.3l2.3,6.9c2.9-1.4,5.8-2.6,8.7-3.5l-2.2-6.6C137.3,41.1,134.4,42.2,131.9,43.3z"/>
<path class="a" d="M86.5,17L82,10.1c-2.5,1.3-5.1,2.7-7.8,4.3l4.6,7C81.4,19.8,83.9,18.3,86.5,17z"/>
<path class="a" d="M107,62l4.8,7.2c1.7-2.5,3.7-4.8,5.9-7.1l-4.5-6.8C110.9,57.4,108.8,59.7,107,62z"/>
<path class="a" d="M92.5,94.2l8.1,6.4c0.4-3.9,1.1-7.8,2.1-11.7l-7.2-5.7C94.2,86.9,93.3,90.6,92.5,94.2z"/>
<path class="a" d="M48.7,46.7l-7.1-6.2c-2.6,2.5-5.1,5-7.4,7.5l7.7,6.6C44,51.9,46.3,49.2,48.7,46.7z"/>
<path class="a" d="M18.5,91.4L7,87.2c-1.9,4.3-4,9.3-5,12l11.5,4.2C14.8,100,16.9,95.1,18.5,91.4z"/>
<path class="a" d="M91,119.6c0.2,5.3,0.7,9.6,1.2,12.6l12,4.3c-0.9-3.9-1.8-8.3-2.4-13L91,119.6z"/>
</g>
</svg>
.center {
text-align: center;
}
.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: #777;
}
p {
font-size: 1.1em;
line-height: 1.7em;
}
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
&:hover {
color: #fff;
text-decoration: none;
}
}
.navbar li a{
color: #fff;
font-size: 18px;
font-weight: bold;
padding: 4px 10px;
}
img {
display: none;
}
.jumbotron {
border-bottom: 10%;
background-color: #dadada;
padding: 60px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
class StaticPagesController < ApplicationController
def index
end
def home
end
......@@ -11,4 +8,7 @@ class StaticPagesController < ApplicationController
def about
end
def contact
end
end
class UsersController < ApplicationController
def new
end
end
module ApplicationHelper
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end
module UsersHelper
end
<footer class="text-white text-center text-lg-start bg-dark">
<!-- Grid container -->
<div class="container p-4">
<!--Grid row-->
<div class="row mt-4">
<!--Grid column-->
<div class="col-lg-4 col-md-12 mb-4 mb-md-0">
<h5 class="text-uppercase mb-4">About company</h5>
<p>
ZIGExN VeNtura is a 100% invested company from Japan. Known as a symbol of a young and dynamic
community in the IT field today, ZIGExN VeNtura operates in the field of software development and
Internet services for the Japanese market.
</p>
<div class="mt-4">
<!-- Facebook -->
<a type="button" class="btn btn-floating btn-primary btn-lg"><i class="fab fa-facebook-f"></i></a>
<!-- Dribbble -->
<a type="button" class="btn btn-floating btn-primary btn-lg"><i class="fab fa-dribbble"></i></a>
<!-- Twitter -->
<a type="button" class="btn btn-floating btn-primary btn-lg"><i class="fab fa-twitter"></i></a>
<!-- Google + -->
<a type="button" class="btn btn-floating btn-primary btn-lg"><i class="fab fa-google-plus-g"></i></a>
<!-- Linkedin -->
</div>
</div>
<!--Grid column-->
<!--Grid column-->
<div class="col-lg-4 col-md-6 mb-4 mb-md-0">
<h5 class="text-uppercase mb-4 pb-1">Search something</h5>
<div class="form-outline form-white mb-4">
<input type="text" id="formControlLg" class="form-control form-control-lg" />
<label class="form-label" for="formControlLg"></label>
</div>
<ul class="fa-ul" style="margin-left: 1.65em;">
<li class="mb-3">
<span class="fa-li"><i class="fas fa-home"></i></span><span class="ms-2">Dong Nai, Viet Nam</span>
</li>
<li class="mb-3">
<span class="fa-li"><i class="fas fa-envelope"></i></span><span class="ms-2">info@example.com</span>
</li>
<li class="mb-3">
<span class="fa-li"><i class="fas fa-phone"></i></span><span class="ms-2">+ 01 234 567 88</span>
</li>
<li class="mb-3">
<span class="fa-li"><i class="fas fa-print"></i></span><span class="ms-2">+ 01 234 567 89</span>
</li>
</ul>
</div>
<!--Grid column-->
<!--Grid column-->
<div class="col-lg-4 col-md-6 mb-4 mb-md-0">
<h5 class="text-uppercase mb-4">Opening hours</h5>
<table class="table text-center text-white">
<tbody class="font-weight-normal">
<tr>
<td>Mon - Thu:</td>
<td>8am - 9pm</td>
</tr>
<tr>
<td>Fri - Sat:</td>
<td>8am - 1am</td>
</tr>
<tr>
<td>Sunday:</td>
<td>9am - 10pm</td>
</tr>
</tbody>
</table>
</div>
<!--Grid column-->
</div>
<!--Grid row-->
</div>
<!-- Grid container -->
<!-- Copyright -->
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);">
© ZigexN Ventura:
<a class="text-white" href="https://zigexn.vn/">zigexn.vn</a>
</div>
<!-- Copyright -->
</footer>
\ No newline at end of file
<header class="navbar navbar-expand-md navbar-light" style="background-color: #003cb3;">
<div class="container">
<%= link_to "sample app", root_path , id: "logo" %>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li><%= link_to "Home",root_path %></li>
<li><%= link_to "Help", help_path %></li>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Log in", '#' %></li>
</ul>
</div>
</div>
</header>
\ No newline at end of file
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js">
</script>
<![endif]-->
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
......@@ -8,8 +7,16 @@
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
<%= render 'layouts/shim' %>
</head>
<body>
<%= yield %>
<%= render 'layouts/header' %>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
<div class="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
</html>
\ No newline at end of file
<% 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>
\ No newline at end of file
<% 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>
<div class="center jumbotron">
<h1>Welcome to the Sample App</h1>
<h2>
This is the home page for the
<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
</h2>
<%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %>
</div>
<%= link_to image_tag("rails.svg", alt: "Rails logo", width: "200"),
"https://rubyonrails.org/" %>
<img alt="Rails logo" width="200px" src="/assets/kitten.jpg">
<% provide(:title, "Page Title") %>
<!DOCTYPE html>
<html>
<head>
<title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title>
</head>
<body>
Contents
</body>
</html>
\ No newline at end of file
<h1>Users#new</h1>
<p>Find me in app/views/users/new.html.erb</p>
Rails.application.routes.draw do
get 'static_pages/home', to: 'static_pages#home'
get 'static_pages/help', to: 'static_pages#help'
get 'static_pages/about', to: 'static_pages#about'
#get 'static_pages/home'
#get 'static_pages/help'
#get 'static_pages/about'
root 'static_pages#home'
get 'static_pages', to: 'static_pages#index'
get '/home', to: '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
......@@ -7,20 +7,30 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
end
test "should get home" do
get root_path
get static_pages_home_url
assert_response :success
assert_select "title", "Ruby on Rails Tutorial Sample App"
end
test "should get help" do
get help_path
get static_pages_help_url
assert_response :success
assert_select "title", "Ruby on Rails Tutorial Sample App"
end
test "should get about" do
get about_path
get static_pages_about_url
assert_response :success
assert_select "title", "Ruby on Rails Tutorial Sample App"
end
test "should get contact" do
get contact_path
get static_pages_contact_url
assert_response :success
assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
end
end
require "test_helper"
class UsersControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get users_new_url
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
end
end
\ No newline at end of file
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