Commit 8ea07e52 by Ba Toi Dang

Merge branch 'design_page' into 'master'

Design page

See merge request !2
parents 3ddf4fbe a583fb3e
Pipeline #481 failed with stages
in 0 seconds
File added
...@@ -3,6 +3,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ...@@ -3,6 +3,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.0' ruby '2.7.0'
gem 'bootstrap', '~> 4.4.1'
gem 'jquery-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.2', '>= 6.0.2.1' gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
...@@ -28,6 +31,8 @@ gem 'jbuilder', '~> 2.7' ...@@ -28,6 +31,8 @@ gem 'jbuilder', '~> 2.7'
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false gem 'bootsnap', '>= 1.4.2', require: false
gem 'sprockets', '~> 3.7.2'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
......
...@@ -58,9 +58,15 @@ GEM ...@@ -58,9 +58,15 @@ GEM
zeitwerk (~> 2.2) zeitwerk (~> 2.2)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (9.7.4)
execjs
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.5) bootsnap (1.4.6)
msgpack (~> 1.0) msgpack (~> 1.0)
bootstrap (4.4.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
builder (3.2.4) builder (3.2.4)
byebug (11.1.1) byebug (11.1.1)
capybara (3.31.0) capybara (3.31.0)
...@@ -75,6 +81,7 @@ GEM ...@@ -75,6 +81,7 @@ GEM
concurrent-ruby (1.1.6) concurrent-ruby (1.1.6)
crass (1.0.6) crass (1.0.6)
erubi (1.9.0) erubi (1.9.0)
execjs (2.7.0)
ffi (1.12.2) ffi (1.12.2)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
...@@ -82,6 +89,10 @@ GEM ...@@ -82,6 +89,10 @@ GEM
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jbuilder (2.10.0) jbuilder (2.10.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
...@@ -103,6 +114,7 @@ GEM ...@@ -103,6 +114,7 @@ GEM
nio4r (2.5.2) nio4r (2.5.2)
nokogiri (1.10.8) nokogiri (1.10.8)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
popper_js (1.16.0)
public_suffix (4.0.3) public_suffix (4.0.3)
puma (4.3.1) puma (4.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
...@@ -141,7 +153,7 @@ GEM ...@@ -141,7 +153,7 @@ GEM
rb-fsevent (0.10.3) rb-fsevent (0.10.3)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (1.6.0) regexp_parser (1.7.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (2.2.0) rubyzip (2.2.0)
sass-rails (6.0.0) sass-rails (6.0.0)
...@@ -161,7 +173,7 @@ GEM ...@@ -161,7 +173,7 @@ GEM
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (4.0.0) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.1) sprockets-rails (3.2.1)
...@@ -202,9 +214,11 @@ PLATFORMS ...@@ -202,9 +214,11 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
bootsnap (>= 1.4.2) bootsnap (>= 1.4.2)
bootstrap (~> 4.4.1)
byebug byebug
capybara (>= 2.15) capybara (>= 2.15)
jbuilder (~> 2.7) jbuilder (~> 2.7)
jquery-rails
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mysql2 mysql2
puma (~> 4.1) puma (~> 4.1)
...@@ -213,6 +227,7 @@ DEPENDENCIES ...@@ -213,6 +227,7 @@ DEPENDENCIES
selenium-webdriver selenium-webdriver
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
sprockets (~> 3.7.2)
sqlite3 (~> 1.4) sqlite3 (~> 1.4)
turbolinks (~> 5) turbolinks (~> 5)
tzinfo-data tzinfo-data
......
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
@import "bootstrap";
body {
padding: 0;
margin: 0;
background: #f2f6e9;
}
.rowtp {
color: red;
text-transform: uppercase;
text-align: center;
margin: auto;
width: 50%;
border: 3px solid green;
padding: 10px;
}
.form-inline {
color: red;
text-transform: uppercase;
text-align: center;
margin: auto;
width: 50%;
padding: 10px;
}
ul.class-name li {
float:left; width:50%;
}
.text {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
#banner{
overflow: hidden;
background-image:url(https://ads.careerbuilder.vn/www/images/64ad182ac0b52d0f4c9bcc2bc24beb6b.jpg);
background-size:100% 100%;
}
/*--- navigation bar ---*/
.navbar {
background:#262626
}
.nav-link,
.navbar-brand {
color: #fff;
cursor: pointer;
}
.nav-link {
margin-right: 1em !important;
}
.nav-link:hover {
color: #000;
}
.navbar-collapse {
justify-content: flex-end;
}
class TopPageController < ApplicationController
def index
@total_jobs = Job.count
@latest_jobs = Job.latest_job
@top_industries = Industry.top_industry_by_job
@top_cities = City.top_city_by_job
end
end
// sass variable overrides
$body-bg: aliceblue;
$body-color: #111;
@import "~bootstrap/scss/bootstrap.scss"
...@@ -7,6 +7,12 @@ require("@rails/ujs").start() ...@@ -7,6 +7,12 @@ require("@rails/ujs").start()
require("turbolinks").start() require("turbolinks").start()
require("@rails/activestorage").start() require("@rails/activestorage").start()
require("channels") require("channels")
import 'jquery'
import 'css/site'
import 'popper.js'
//= require jquery3
//= require popper
//= require bootstrap-sprockets
// Uncomment to copy all static images under ../images to the output folder and reference // Uncomment to copy all static images under ../images to the output folder and reference
......
...@@ -2,4 +2,5 @@ class City < ApplicationRecord ...@@ -2,4 +2,5 @@ class City < ApplicationRecord
belongs_to :area belongs_to :area
has_many :jobs has_many :jobs
validates_presence_of :city_name validates_presence_of :city_name
scope :top_city_by_job, ->{joins(:jobs).select('cities.*, COUNT(jobs.id) as job_count').group('jobs.city_id').order(:job_count).last(9)}
end end
class Industry < ApplicationRecord class Industry < ApplicationRecord
has_many :industry_jobs has_many :industry_jobs
has_many :jobs
validates_presence_of :industry_name validates_presence_of :industry_name
scope :top_industry_by_job, ->{joins(:jobs).select('industries.*, COUNT(jobs.id) as job_count').group('jobs.industry_id').order(:job_count).last(9)}
end end
...@@ -7,4 +7,5 @@ class Job < ApplicationRecord ...@@ -7,4 +7,5 @@ class Job < ApplicationRecord
belongs_to :city belongs_to :city
belongs_to :company belongs_to :company
validates_presence_of :job_name validates_presence_of :job_name
scope :latest_job, ->{order(:last_updated).first(5)}
end end
...@@ -7,9 +7,54 @@ ...@@ -7,9 +7,54 @@
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head> </head>
<body> <body>
<div class="container p-0 my-2 ">
<nav class="navbar navbar-expand-md">
<a class="navbar-brand" href="#"><img src="https://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com" style="width:104px;height:142px;"></a>
<button class="navbar-toggler navbar-dark" type="button" data-toggle="collapse" data-target="#main-navigation">
</button>
<div class="collapse navbar-collapse" id="main-navigation">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Favorite</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">History</a>
</li>
</ul>
</div>
</nav>
</div>
<%= yield %> <%= yield %>
<footer class="page-footer">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12">
<h6 class="text-uppercase font-weight-bold">Additional Information</h6>
<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. Being present in Vietnam market since the beginning of 2013, with the right steps from the Board of Directors and enthusiastic, creative and enthusiastic staff, ZIGExN VeNtura is growing and developing constantly.</p>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<h6 class="text-uppercase font-weight-bold">Contact</h6>
<p>Floor 11, VINA BUILDING, 131 Xo Viet Nghe Tinh, Ward 17, Binh Thanh District, Ho Chi Minh City, VietNam
<br/>info@zigexn.vn
<br/>(84)-838-633-399</p>
</div>
</div>
<div class="footer-copyright text-center">© 2020 Copyright: zigexn.vn</div>
</footer>
</body> </body>
</html> </html>
<div id="banner" class="container p-5 my-2 bg-secondary text-white">
<div class="rowtp">
<label> Total Jobs: <%= @total_jobs %></label>
</div>
</div>
<div id="search" class="container p-5 my-2 bg-secondary text-white">
<!-- Search form -->
<form class="form-inline md-form mr-auto mb-4">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-warning btn-rounded btn-sm my-0" type="submit">Search</button>
</form>
</div>
<div id="latestjobs"class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Latest Jobs:</label></b></font>
<% @latest_jobs.each do |latest_job| %>
<ul>
<li><%= latest_job.job_name %></li>
<li><%= latest_job.salary.to_s %></li>
<li><%= latest_job.experience %></li>
<li><%= latest_job.last_updated %></li>
<li ><span class="text"><%= latest_job.description %></span></li>
</ul>
<% end %>
</div>
<div id="topcity" class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Top Cities:</label></b></font>
<% @top_cities.each do |top_city| %>
<ul>
<li><%= top_city.city_name %></li>
</ul>
<% end %>
</div>
<div id="topindustry" class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Top Industry:</label></b></font>
<% @top_industries.each do |top_industry| %>
<ul>
<li><%= top_industry.industry_name %></li>
</ul>
<% end %>
</div>
Rails.application.routes.draw do Rails.application.routes.draw do
root 'top_page#index'
# 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
resources :top_page
end end
...@@ -47,21 +47,33 @@ namespace :crawler do ...@@ -47,21 +47,33 @@ namespace :crawler do
#skip if field blank #skip if field blank
next if industry.text.blank? next if industry.text.blank?
#insert data to City table: #insert data to City table:
city_name = location.text.gsub(",", "") city_name = location.text.gsub(",", "")
city = City.find_or_create_by(area_id: area.id, city_name: city_name, city_description: "")
city = City.find_by(area_id: area.id, city_name: city_name)
city = City.create(area_id: area.id, city_name: city_name, city_description: "") unless city
#insert data to Industry table #insert data to Industry table
industry = Industry.find_or_create_by(industry_name: industry.text, industry_description: "") industry_row = Industry.find_by(industry_name: industry.text)
industry_row = Industry.create(industry_name: industry.text, industry_description: "") unless industry_row
#insert data to Companies table #insert data to Companies table
company = Company.find_or_create_by(company_name: company_name.text, company_description: company_intro.text, address: address.text) company = Company.find_by(company_name: company_name.text)
company = Company.create(company_name: company_name.text, company_description: company_intro.text, address: address.text) unless company
#insert data to Jobs table #insert data to Jobs table
Job.find_or_create_by(area_id: area.id, city_id: city.id , industry_id: industry.id, company_id: company.id, job_name: title.text, salary: salary.text, deadline: deadline.text, level: level.text, experience: experience.text.strip, last_updated: updated_date.text.strip, description: description.text) job_row = Job.find_by(area_id: area.id, city_id: city.id, industry_id: industry_row.id, company_id: company.id, job_name: title.text)
job_row = Job.create(area_id: area.id, city_id: city.id, industry_id: industry_row.id, company_id: company.id, job_name: title.text, salary: salary.text, deadline: deadline.text, level: level.text, experience: experience.text.strip, last_updated: updated_date.text.strip, description: description.text) unless job_row
#insert data to Industry_Jobs table
unless IndustryJob.exists?(industry_id: industry_row.id, job_id: job_row.id)
IndustryJob.create(industry_id: industry_row.id, job_id: job_row.id)
end end
end
list_url = nextpage[0]["href"] list_url = nextpage[0]["href"]
end end
end end
end end
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
"@rails/activestorage": "^6.0.0", "@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0", "@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.2.2", "@rails/webpacker": "4.2.2",
"bootstrap": "^4.4.1",
"jquery": "^3.4.1",
"popper.js": "^1.16.1",
"turbolinks": "^5.2.0" "turbolinks": "^5.2.0"
}, },
"version": "0.1.0", "version": "0.1.0",
......
...@@ -1386,6 +1386,11 @@ boolbase@^1.0.0, boolbase@~1.0.0: ...@@ -1386,6 +1386,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
bootstrap@^4.4.1:
version "4.4.1"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.4.1.tgz#8582960eea0c5cd2bede84d8b0baf3789c3e8b01"
integrity sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA==
brace-expansion@^1.1.7: brace-expansion@^1.1.7:
version "1.1.11" version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
...@@ -3824,6 +3829,11 @@ jest-worker@^24.9.0: ...@@ -3824,6 +3829,11 @@ jest-worker@^24.9.0:
merge-stream "^2.0.0" merge-stream "^2.0.0"
supports-color "^6.1.0" supports-color "^6.1.0"
jquery@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2"
integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==
js-base64@^2.1.8: js-base64@^2.1.8:
version "2.5.1" version "2.5.1"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121"
...@@ -5029,6 +5039,11 @@ pnp-webpack-plugin@^1.5.0: ...@@ -5029,6 +5039,11 @@ pnp-webpack-plugin@^1.5.0:
dependencies: dependencies:
ts-pnp "^1.1.2" ts-pnp "^1.1.2"
popper.js@^1.16.1:
version "1.16.1"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b"
integrity sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==
portfinder@^1.0.25: portfinder@^1.0.25:
version "1.0.25" version "1.0.25"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.25.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.25.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca"
......
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