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
def full_title(page_title = '')
base_title = "VeNJOB"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end
<header class="navbar navbar-fixed-top navbar-inverse">
<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>
</header>
<!DOCTYPE html>
<html>
<head>
<title><%= yield(:title) %> | VeNJOB</title>
<title><%= full_title(yield(:title)) %></title>
<%= render "layouts/rails_default" %>
</head>
<body>
<%= render "layouts/header" %>
<%= yield %>
<div class="container">
<%= yield %>
<%= render "layouts/footer" %>
</div>
</body>
</html>
<% provide(:title, "Top Page") %>
<h1>VeNJOB Top page</h1>
......@@ -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
root "static_pages#top_page"
get "static_pages/top_page"
get "static_pages/favorite"
get "static_pages/history"
get "/favorite", to: "static_pages#favorite"
get "/history",to: "static_pages#history"
end
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "VeNJOB"
end
test "should get top_page" do
get static_pages_top_page_url
get root_path
assert_response :success
assert_select "title", "Top Page | #{@base_title}"
assert_select "title", "VeNJOB"
end
test "should get favorite" do
get static_pages_favorite_url
get favorite_url
assert_response :success
assert_select "title", "Favorite | #{@base_title}"
assert_select "title", "Favorite | VeNJOB"
end
test "should get history" do
get static_pages_history_url
get history_url
assert_response :success
assert_select "title", "History | #{@base_title}"
assert_select "title", "History | VeNJOB"
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