Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Huỳnh Thiên Phước
venjob
Commits
c18c0034
Commit
c18c0034
authored
Jul 30, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use bootstrap divide column
parent
79e6c572
Pipeline
#743
failed with stages
in 0 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
57 deletions
+54
-57
app/assets/stylesheets/all_page.css.scss
+0
-0
app/assets/stylesheets/top_pages.scss
+21
-8
app/controllers/jobs_controller.rb
+0
-3
app/controllers/top_pages_controller.rb
+0
-1
app/views/layouts/_show_cities.html.erb
+7
-13
app/views/layouts/_show_industries.html.erb
+7
-15
app/views/layouts/_show_jobs.html.erb
+1
-0
app/views/top_pages/index.html.erb
+8
-8
lib/src/crawler.rb
+3
-3
lib/src/crontab.rb
+7
-6
No files found.
app/assets/stylesheets/
custom
.css.scss
→
app/assets/stylesheets/
all_page
.css.scss
View file @
c18c0034
File moved
app/assets/stylesheets/top_pages.scss
View file @
c18c0034
...
...
@@ -30,6 +30,8 @@
height
:
100%
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
font-style
:
italic
;
font-family
:
Bookman
,
URW
Bookman
L
,
serif
;
}
.salary
{
color
:
green
;
...
...
@@ -45,14 +47,26 @@
top
:
20%
;
right
:
5%
;
}
.row-table
{
color
:
black
;
padding
:
50px
;
margin
:
30px
;
padding
:
15px
;
margin
:
15px
;
text-align
:
center
;
border
:
1px
solid
red
;
}
.city-banner
{
background
:
linear-gradient
(
to
top
,
#33ccff
0%
,
#006600
100%
);
font-size
:
38px
;
text-align
:
center
;
border
:
2px
solid
red
;
color
:
white
;
font-style
:
italic
;
font-family
:
Bookman
,
URW
Bookman
L
,
serif
;
}
.industry-banner
{
background
:
linear-gradient
(
to
top
,
#33ccff
0%
,
#006666
100%
);
font-size
:
38px
;
text-align
:
center
;
color
:
white
;
font-style
:
italic
;
font-family
:
Bookman
,
URW
Bookman
L
,
serif
;
}
table
{
width
:
100%
;
}
\ No newline at end of file
app/controllers/jobs_controller.rb
View file @
c18c0034
class
JobsController
<
ApplicationController
def
index
end
end
app/controllers/top_pages_controller.rb
View file @
c18c0034
...
...
@@ -4,6 +4,5 @@ class TopPagesController < ApplicationController
@jobs
=
Job
.
limit
(
5
).
order
(
created_at: :desc
)
@jobs_of_cities
=
CityJob
.
limit
(
9
).
group
(
'city_id'
).
order
(
'Count(*) DESC'
).
count
@jobs_of_industries
=
IndustryJob
.
limit
(
9
).
group
(
'industry_id'
).
order
(
'Count(*) DESC'
).
count
@index
=
0
end
end
app/views/layouts/_show_cities.html.erb
View file @
c18c0034
<%
@jobs_of_cities
.
each
do
|
city
,
count_job
|
%>
<%
@index
+=
1
%>
<%
if
@index
%
3
==
0
%>
<td
class=
"row-table"
>
<div
class=
"city-name"
><strong>
<%=
City
.
find
(
city
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
</tr>
<%
else
%>
<td
class=
"row-table"
>
<div
class=
"city-name"
><strong>
<%=
City
.
find
(
city
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
<%
end
%>
<div
class=
"col-4"
>
<div
class=
"row-table"
>
<div
class=
"city-name"
><strong>
<%=
City
.
find
(
city
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</div>
</div>
<%
end
%>
\ No newline at end of file
app/views/layouts/_show_industries.html.erb
View file @
c18c0034
<%
@jobs_of_industries
.
each
do
|
industry
,
count_job
|
%>
<%
@index
+=
1
%>
<%
if
@index
%
3
==
0
%>
<td
class=
"row-table"
>
<div
class=
"industry-name"
><strong>
<%=
Industry
.
find
(
industry
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
</tr>
<%
else
%>
<td
class=
"row-table"
>
<div
class=
"industry-name"
><strong>
<%=
Industry
.
find
(
industry
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
<%
end
%>
<%
end
%>
\ No newline at end of file
<div
class=
"col-4"
>
<div
class=
"row-table"
>
<div
class=
"industry-name"
><strong>
<%=
Industry
.
find
(
industry
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</div>
</div>
<%
end
%>
app/views/layouts/_show_jobs.html.erb
View file @
c18c0034
...
...
@@ -10,6 +10,7 @@
<%=
city
.
name
%>
<%
end
%>
</div>
<%
job
.
description
.
html_safe
%>
<button
type=
"button"
class=
"btn btn-primary"
id=
"button-follow"
>
♥ Follow
</button>
</div>
</div>
...
...
app/views/top_pages/index.html.erb
View file @
c18c0034
...
...
@@ -6,12 +6,12 @@
</div>
<div
class=
"container"
>
<div
class=
"job-list"
>
<%=
render
'layouts/show_jobs'
%>
</div>
<div>
<div
class=
"city-banner"
>
City
</div>
</div>
<table
class=
"city-list"
>
<%=
render
'layouts/show_cities'
%>
</table>
<div
class=
"city-banner"
>
Industry
</div>
<table
class=
"industry-list"
>
<%=
render
'layouts/show_industries'
%>
</table>
</div>
<div
class=
"city-banner"
>
City
</div>
<div
class=
"container"
>
<div
class=
"row"
>
<%=
render
'layouts/show_cities'
%>
</div>
</div>
<div
class=
"industry-banner"
>
Industry
</div>
<div
class=
"container"
>
<div
class=
"row"
>
<%=
render
'layouts/show_industries'
%>
</div>
</div>
lib/src/crawler.rb
View file @
c18c0034
...
...
@@ -60,8 +60,8 @@ class Crawler
end
def
crawl_job_relationships
(
1
..
10
).
each
do
|
n
|
page_access
=
Nokogiri
::
HTML
(
URI
.
open
(
"https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-
#{
n
}
-vi.html"
))
#
(1..10).each do |n|
page_access
=
Nokogiri
::
HTML
(
URI
.
open
(
"https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-
1
-vi.html"
))
get_link
=
page_access
.
css
(
'a.job_link'
).
map
{
|
link
|
link
[
'href'
]
}
get_link
.
each
do
|
link
|
page_job
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
parse
(
URI
.
escape
(
link
))))
...
...
@@ -114,7 +114,7 @@ class Crawler
end
end
end
end
#
end
end
def
get_file_csv
...
...
lib/src/crontab.rb
View file @
c18c0034
...
...
@@ -34,17 +34,17 @@ class Crontab
get_row
=
page_job
.
search
(
'div.bg-blue div.row'
)
if
get_row
.
present?
begin
get_name_company
=
page_job
.
search
(
'div.job-desc a.job-company-name'
).
text
.
strip
company_table
=
Company
.
find_by
(
name:
get_name_company
)
title_job
=
page_job
.
search
(
'div.job-desc p'
).
text
description
=
page_job
.
search
(
'div.detail-row'
)
get_name_company
=
page_job
.
search
(
'div.job-desc a.job-company-name'
).
text
.
strip
company_table
=
Company
.
find_by
(
name:
get_name_company
)
title_job
=
page_job
.
search
(
'div.job-desc p'
).
text
description
=
page_job
.
search
(
'div.detail-row'
)
next
if
company_table
.
nil?
job_check
=
Job
.
find_by
(
title:
title_job
,
company_id:
company_table
.
id
)
salary
=
get_row
.
at_xpath
(
'//li[./strong/i[contains(@class, "fa fa-usd")]]/p'
).
text
.
strip
experience
=
get_row
.
at_xpath
(
'//li[./strong/i[contains(@class, "fa fa-briefcase")]]/p'
).
text
.
strip
level
=
get_row
.
at_xpath
(
'//li[./strong/i[contains(@class, "mdi mdi-account")]]/p'
).
text
.
strip
expiration_date
=
get_row
.
at_xpath
(
'//li[./strong/i[contains(@class, "mdi mdi-calendar-check")]]/p'
).
text
.
strip
if
job_check
.
blank
?
if
job_check
.
nil
?
job
=
Job
.
create!
(
title:
title_job
,
level:
level
,
salary:
salary
,
...
...
@@ -76,7 +76,8 @@ class Crontab
end
end
rescue
StandardError
=>
e
@mylogger
.
error
"
#{
e
.
message
}
"
# @mylogger.error "#{e.message}"
puts
e
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment