Commit 2e9845a6 by Hoang Phuc Do

Merge branch 'toppage' into 'master'

created top page

See merge request !4
parents a35aba16 c4382f23
Pipeline #772 failed with stages
in 0 seconds
$(document).on("turbolinks:load", function(){
$('.block_click_favorite').click(function (e) {
$('.overlay_login').addClass('show');
});
$('.icon_close_modal_login').click(function (e) {
$('.overlay_login').removeClass('show');
});
// => scroll to top
$(window).scroll(function(){
if ($(this).scrollTop() > 550) {
$(".btn-scroll-top").css('opacity',1);
$(".btn-scroll-top").fadeIn(400);
} else {
$(".btn-scroll-top").fadeOut(400);
}
});
$(".btn-scroll-top").click(function (e){
var body = $("html, body");
body.stop().animate({ scrollTop: 0}, 700, 'swing')
});
// => end
$(".btn_option_location-vn").click(function (){
var body = $("html, body");
$('.btn_option_location-vn').addClass('active');
body.stop().animate({ scrollTop: $('.title_list_city_vn').offset().top}, 700, 'swing');
});
$(".btn_option_location-qt").click(function (){
var body = $("html, body");
console.log('bam')
body.stop().animate({ scrollTop: $('.title_list_city_qt').offset().top}, 700, 'swing');
});
});
.box_link_favotite {
position: relative;
width: 100%;
height: 100%;
padding: 10px 10px;
span {
color: #999;
}
}
.block_link_favorite :hover {
color: #e62958;
}
.block_link_favorite.md {
display: none;
}
.link_favorite {
color: #999;
z-index: 100000;
&:hover {
text-decoration: none;
}
}
.block_click_favorite {
color: #999;
cursor: pointer;
}
.block_click_favorite.md {
display: none;
}
.link_favorite_top {
position: absolute;
z-index: 1;
// position: relative;
padding: 15px 20px;
top: 0;
right: 0;
}
.overlay_login {
visibility: hidden;
opacity: 0;
transition: 0.5;
position: fixed;
z-index: 99999;
top: 0;
bottom: 0;
left: 0;
right: 0;
transition: linear 0.2s;
background-color: rgba($color: #000000, $alpha: 0.5);
}
.overlay_login.show {
opacity: 1;
visibility: visible;
transition: linear 0.2s;
}
.modal_login {
position: absolute;
overflow: hidden;
top: 50%;
left: 50%;
height: 300px;
width: 600px;
transform: translateY(-50%) translateX(-50%);
background-color: #fff;
border-radius: 5px;
transition: cubic-bezier(0.165, 0.84, 0.44, 1);
}
// modal
.icon_close_modal_login {
cursor: pointer;
float: right;
transform: translateX(-10px);
font-size: 22px;
font-weight: 100;
color: rgba($color: #999, $alpha: 0.9);
span {
}
}
.modal_login_notice_text {
text-align: center;
color: #666;
font-size: 19px;
color: rgb(60, 71, 121);
span {
}
}
.modal_login_header {
background-color: #eee;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 18px;
color: #333;
font-weight: 600;
font-family: 'Raleway', sans-serif;
}
@media only screen and (max-width: 768px) {
.block_link_favorite.lg {
display: none;
}
.block_click_favorite.lg {
display: none;
}
.block_link_favorite.md {
display: block;
}
.block_click_favorite.md {
display: block;
}
.pagination li a {
font-size: 14px !important;
}
.modal_login {
width: 95vw;
font-size: 14px;
}
.modal_login_header {
font-size: 15px;
}
.icon_close_modal_login {
font-size: 15px;
}
}
@media only screen and (max-width: 576px) {
.pagination li a {
font-size: 13px !important;
}
}
# frozen_string_literal: true
# Home page
class HomeController < ApplicationController
def index
@industries = Industry.order(name: :asc).all
@job_count = Job.count
@cities = City.all_cities
@lasted_jobs = Job.order(created_at: :desc).limit(Job::NUMBER_LASTED_JOB)
@top_cities = City.top_cities(9)
@top_industries = Industry.top_industries(9)
end
end
class JobController < ApplicationController
end
# frozen_string_literal: true
# Application Helper
module ApplicationHelper module ApplicationHelper
def full_title(page_title)
base_title = 'VenJob'
page_title.empty? ? base_title : "#{base_title} | #{page_title}"
end
end end
module HomeHelper
end
module JobHelper
end
...@@ -4,4 +4,10 @@ ...@@ -4,4 +4,10 @@
class City < ApplicationRecord class City < ApplicationRecord
has_many :city_jobs has_many :city_jobs
has_many :jobs, through: :city_jobs has_many :jobs, through: :city_jobs
scope :all_cities, -> { select :id, :name }
scope :top_cities, ->(number) do joins(:jobs)
.group(:city_id)
.order(Arel.sql('count(jobs.id) DESC'))
.take(number)
end
end end
...@@ -4,4 +4,9 @@ ...@@ -4,4 +4,9 @@
class Industry < ApplicationRecord class Industry < ApplicationRecord
has_many :industry_jobs has_many :industry_jobs
has_many :jobs, through: :industry_jobs has_many :jobs, through: :industry_jobs
scope :top_industries, ->(number) do joins(:jobs)
.group(:industry_id)
.order(Arel.sql('count(jobs.id) DESC'))
.take(number)
end
end end
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Description/Explanation of Person class # Description/Explanation of Person class
class Job < ApplicationRecord class Job < ApplicationRecord
NUMBER_LASTED_JOB = 5
belongs_to :company belongs_to :company
has_many :industry_jobs has_many :industry_jobs
......
<div class = "box-banner">
<%= image_tag 'banner-search-box-home', class: "banner-top" %>
<div class="row">
<div class="col-xs-12">
<div class = "slogan">
<h2 class = "slogan_text">
NỀN TẢNG TUYỂN DỤNG NHÂN SỰ VENJOB
</h2>
<h5 class = "slogan_text_h5">
NỀN TẢNG TUYỂN DỤNG NHÂN SỰ VENJOB
</h5>
</div>
</div>
</div>
<!-- Process search pc-->
<div class="box-search">
<div class="search_scaffold">
<div class = "total_job">
<% if @job_count.blank? %>
<h4 class="show_total_job">Khám phá ngay những việc làm tốt nhất trên VenJob</h4>
<% else %>
<h4 class="show_total_job">Khám phá ngay <b><%= @job_count%></b> việc làm tốt nhất trên VenJob</h4>
<% end %>
</div>
<div class="filter_box">
<div class="search_input">
<input type="search" name="" id="" class="custom_input_search" placeholder="Nhập tiêu đề, công ty, địa điểm...">
</div>
<div class="search_industries">
<div class="icon_list">
<i class="fa fa-list-ul" aria-hidden="true"></i>
</div>
<select class="show_list_industries">
<option value="*" selected disabled hidden class="select_first">Tất cả ngành nghề</option>
<% @industries.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
<div class="search_location">
<div class="icon_list">
<i class="fas fa-map-marker-alt"></i>
</div>
<select class="show_list_cities">
<option value="*" selected disabled hidden class="select_first">Tất cả Tỉnh thành</option>
<% @cities.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
<div class="search_submit">
<button type="submit" class="btn_search_submit">
<i class="fas fa-search"></i>
Tìm việc
</button>
</div>
</div>
</div>
</div>
<!-- Process search tablet-->
<div class="box-search-tablet">
<div class="search_scaffold-tablet">
<div class = "total_job">
<h4 class="show_total_job">Khám phá ngay <b><%=@job_count%></b> việc làm tốt nhất trên VenJob</h4>
</div>
<div class="filter_box filter_box_tablet">
<div class="search_input">
<input type="search" name="" id="" class="custom_input_search" placeholder="Nhập tiêu đề, công ty, địa điểm...">
</div>
<div class="search_industries">
<div class="icon_list">
<i class="fa fa-list-ul" aria-hidden="true"></i>
</div>
<select class="show_list_industries">
<option value="*" selected disabled hidden class="select_first">Tất cả ngành nghề</option>
<% @industries.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
<div class="search_location">
<div class="icon_list">
<i class="fas fa-map-marker-alt"></i>
</div>
<select class="show_list_cities">
<option value="*" selected disabled hidden class="select_first">Tất cả Tỉnh thành</option>
<% @cities.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
<div class="search_submit">
<button type="submit" class="btn_search_submit">
<i class="fas fa-search"></i>
Tìm việc
</button>
</div>
</div>
</div>
</div>
<div class="box-show-total-jobs-mobile">
<span>Khám phá ngay <%=@job_count%></b> việc làm tốt nhất trên VenJob</span>
</div>
<!-- Process search mobile-->
<div class="box-search-mobile">
<div class="fillter-search-mobile">
<div class="container">
<div class="row no-gutters">
<div class="col-md-12">
<input type="search" name="" id="" class="custom_input_mobile_search" placeholder="Nhập tiêu đề, công ty, địa điểm...">
</div>
<div class="col-sm-6 col-xs-12">
<div class="search_industries_mobile">
<select class="show_list_industries_mobile">
<option value="*" selected disabled hidden class="select_first">Tất cả ngành nghề</option>
<% @industries.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="search_location_mobile">
<select class="show_list_cities_mobile">
<option value="*" selected disabled hidden class="select_first">Tất cả Tỉnh thành</option>
<% @cities.each do |val| %>
<option value="<%= val.id %>"><%= val.name %></option>
<% end %>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row no-gutters">
<div class="col-sm-12">
<button type="submit" class="btn_search_submit">
<i class="fas fa-search"></i>
Tìm việc
</button>
</div>
</div>
</div>
</div>
</div>
<%= render 'job/modal_login'%>
<%cru = 0%>
<div class="container">
<div class="row">
<div class="col-sm-12">
<% @lasted_jobs.each do |val| %>
<div class="box_jobs">
<div class="col-sm-12 d-block d-sm-none">
<% if cru == 1 %>
<div class="link_favorite_top block_link_favorite md">
<span><%= link_to '<i class="far fa-heart"></i>'.html_safe, '#', class: 'link_favorite'%><span>
</div>
<% else %>
<div class="block_click_favorite link_favorite_top ">
<span><i class="far fa-heart"></i><span>
</div>
<% end %>
</div>
<div class="row">
<div class="col-sm-10 col-md-9 col-lg-10">
<div class="box_info">
<div class="lol">
<%= link_to val.name, '#', class: 'job_name' %>
</div>
<div class="cop">
<h5 class="box_info_copany_name"><i class="far fa-building"></i> <%= val.company.name %></h5>
</div>
<div class="loc">
<h5 class="box_info_location"><i class="fas fa-map-marker-alt"></i>
<% dt = [] %>
<% val.cities.each do |x| %>
<% dt << (x.name << ' | ') %>
<% end %>
<%= dt.join('').chomp('| ')%>
</h5>
</div>
<h5 class="box_info_salary"><i class="fas fa-dollar-sign"></i>&nbsp; Lương: <%= val.salary %></h5>
<div class="coc">
<h5 class="box_info_des"><%= strip_tags(val.description) %></h5>
</div>
</div>
</div>
<div class="col-sm-2 col-md-3 d-none d-sm-block col-lg-2">
<% if cru == 1 %>
<div class="box_link_favotite">
<div class="block_link_favorite lg">
<span><i class="far fa-heart"></i> <%= link_to 'Yêu thích'.html_safe, '#', class: 'link_favorite' %><span>
</div>
<div class="block_link_favorite md">
<span><%= link_to '<i class="far fa-heart"></i>'.html_safe, '#', class: 'link_favorite' %><span>
</div>
</div>
<% else %>
<div class="box_link_favotite">
<div class="block_click_favorite lg">
<span><i class="far fa-heart"></i> Yêu thích<span>
</div>
<div class="block_click_favorite md">
<span><i class="far fa-heart"></i><span>
</div>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<div class="container">
<div class="border_box_cities">
<div class="box_text_five_jobs box_padding_city">
<span>Top thành phố</span>
</div>
<div class="row no-gutters">
<% @top_cities.each do |city| %>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to city.name, '#' ,class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<%= link_to "#{city.jobs.count} công việc", '#' ,class: 'link_ct' %>
</div>
</div>
</div>
<% end %>
<div class="col-lg-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to 'Xem Thêm', '#', class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<i class="fas fa-ellipsis-h"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="border_box_cities">
<div class="box_text_five_jobs box_padding_city">
<span>Top các nghành phổ biến</span>
</div>
<div class="row no-gutters">
<% @top_industries.each do |industry| %>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to industry.name, '#', class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<%= link_to "#{industry.jobs.count} công việc", '#', class: 'link_ct' %>
</div>
</div>
</div>
<% end %>
<div class="col-lg-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to 'Xem Thêm', '#', class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<i class="fas fa-ellipsis-h"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<% provide(:title ,'Trang chủ') %>
<%= render 'home/banner_and_search' %>
<div class="padding_index"></div>
<% unless @job_count.nil? %>
<div class="box_text_five_jobs">
<span>Năm công việc mới nhất dành cho bạn</span>
</div>
<%= render 'box_five_job' %>
<%= render 'box_nine_city' %>
<%= render 'box_nine_industries' %>
<%= render 'shared/scroll_top' %>
<% end %>
<div class="overlay_login">
<div class="modal_login">
<div class="modal_login_header">
<span>VUI LÒNG ĐĂNG NHẬP ĐỂ THỰC HIỆN CHỨC NĂNG NÀY</span>
<span class="icon_close_modal_login">
<i class="fas fa-times"></i>
</span>
</div>
<div class="container">
<div class="row">
<div class="col-lg 12">
<div class="modal_login_notice_text">
<span>ĐĂNG NHẬP</span>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<footer class = "custom_footer">
<div class = "container">
<div class = "copyright">
Copyright &copy; ZIGExN VeNtura 2020
</div>
</div>
</footer>
\ No newline at end of file
<header class="cus_header">
<div class="header_top">
<div class="header_top_logo">
<%= link_to image_tag('logo.png', alt: 'logo', class: 'logo_header'), '/' %>
</div>
<input class="check-nav-mobile" type="checkbox" name="" id="mobile-nav" hidden>
<label for="mobile-nav" class="lbn-nav">&#9776</label>
<label for="mobile-nav" class="overlay"></label>
<div class = "override"></div>
<div class="header_top_menu_right">
<ul class="list_menu_header_right">
<li class="list_item_menu_header_right">
<%= link_to 'Yêu thích', '#', class: 'link_item_menu_header_right' %>
</li>
<li class="list_item_menu_header_right">
<%= link_to 'Lịch sử', '#', class: 'link_item_menu_header_right' %>
</li>
<li class="list_item_menu_header_right">
<%= link_to 'Đăng nhập', '#', class: 'link_item_menu_header_right' %>
</li>
<li class="list_item_menu_header_right">
<%= link_to 'Đăng ký', '#', class: 'link_item_menu_header_right' %>
</li>
</ul>
</div>
<%# mobile %>
<div class = "menu__mobile">
<div class = "content_menu_mobile">
<%= link_to image_tag('avatar.png', alt: 'avatar', class: 'avatar_manu'), '#' %>
<div class = "menu_mobile_vertical">
<ul class = "list_menu_mobile_vertical">
<li class = "item_menu_mobile_vertical">
<%= link_to 'Yêu thích', '#', class: 'link_item_menu_mobile' %>
</li>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Lịch sử', '#', class: 'link_item_menu_mobile' %>
</li>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Đăng nhập', '#', class: 'link_item_menu_mobile' %>
</li>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Đăng ký', '#', class: 'link_item_menu_mobile' %>
</li>
</ul>
</div>
<div>
</div>
</div>
</header>
\ No newline at end of file
<div class = "padding_header_to_body">
<div>
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Venjob</title> <title><%= full_title(yield(:title)) %></title>
<%= favicon_link_tag 'icontitle' %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= render 'shared/shim' %>
</head> </head>
<body> <body>
<div class = "app">
<%= render 'layouts/header' %>
<%= render 'layouts/padding' %>
<%= yield %> <%= yield %>
<%= render 'layouts/footer' %>
</div>
</body> </body>
</html> </html>
<div class="btn-scroll-top">
<div class="box-btn-scroll-top">
<i class="fas fa-caret-up icon-scroll"></i>
</div>
</div>
\ No newline at end of file
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@200&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Raleway&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
\ No newline at end of file
...@@ -9,7 +9,7 @@ threads threads_count, threads_count ...@@ -9,7 +9,7 @@ threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
# #
port ENV.fetch("PORT") { 3000 } port ENV.fetch("PORT") { 1234 }
# Specifies the `environment` that Puma will run in. # Specifies the `environment` that Puma will run in.
# #
......
Rails.application.routes.draw do Rails.application.routes.draw do
root 'home#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end
require 'test_helper'
class HomeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get home_index_url
assert_response :success
end
end
require 'test_helper'
class JobControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# 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