Commit d6b94eef by nnnghia98

header

parent 86dbf669
/* mixin, variables, etc. */
$gray-medium-light: #eaeaea;
$light-gray: #777;
@mixin box_sizing {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* universal */
body {
padding-top: 30px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
module ApplicationHelper module ApplicationHelper
def full_title(page_title = '')
base_title = "VeNJOB"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end end
<header class="navbar navbar-fixed-top navbar-inverse"> <header class="navbar navbar-fixed-top navbar-inverse">
<div class="container"> <div class="container">
<%= link_to image_tag("venjob_logo.png", alt: "VeNJOB Logo") , root_path %> <%= link_to image_tag("venjob_logo.png", alt: "VeNJOB Logo") , root_path, id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<%= link_to "Favorite", favorite_path %>
<%= link_to "History", history_path %>
</ul>
</nav>
</div> </div>
</header> </header>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%= yield(:title) %> | VeNJOB</title> <title><%= full_title(yield(:title)) %></title>
<%= render "layouts/rails_default" %> <%= render "layouts/rails_default" %>
</head> </head>
<body> <body>
<%= render "layouts/header" %> <%= render "layouts/header" %>
<%= yield %> <div class="container">
<%= yield %>
<%= render "layouts/footer" %>
</div>
</body> </body>
</html> </html>
<% provide(:title, "Top Page") %>
<h1>VeNJOB Top page</h1> <h1>VeNJOB Top page</h1>
...@@ -3,6 +3,6 @@ Rails.application.routes.draw do ...@@ -3,6 +3,6 @@ Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root "static_pages#top_page" root "static_pages#top_page"
get "static_pages/top_page" get "static_pages/top_page"
get "static_pages/favorite" get "/favorite", to: "static_pages#favorite"
get "static_pages/history" get "/history",to: "static_pages#history"
end end
require 'test_helper' require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "VeNJOB"
end
test "should get top_page" do test "should get top_page" do
get static_pages_top_page_url get root_path
assert_response :success assert_response :success
assert_select "title", "Top Page | #{@base_title}" assert_select "title", "VeNJOB"
end end
test "should get favorite" do test "should get favorite" do
get static_pages_favorite_url get favorite_url
assert_response :success assert_response :success
assert_select "title", "Favorite | #{@base_title}" assert_select "title", "Favorite | VeNJOB"
end end
test "should get history" do test "should get history" do
get static_pages_history_url get history_url
assert_response :success assert_response :success
assert_select "title", "History | #{@base_title}" assert_select "title", "History | VeNJOB"
end end
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