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
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
45 deletions
+44
-45
app/assets/stylesheets/all_page.css.scss
+0
-0
app/assets/stylesheets/top_pages.scss
+20
-6
app/controllers/jobs_controller.rb
+0
-3
app/controllers/top_pages_controller.rb
+0
-1
app/views/layouts/_show_cities.html.erb
+5
-11
app/views/layouts/_show_industries.html.erb
+4
-11
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
+3
-2
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 @@
...
@@ -30,6 +30,8 @@
height
:
100%
;
height
:
100%
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
background-size
:
cover
;
font-style
:
italic
;
font-family
:
Bookman
,
URW
Bookman
L
,
serif
;
}
}
.salary
{
.salary
{
color
:
green
;
color
:
green
;
...
@@ -45,14 +47,26 @@
...
@@ -45,14 +47,26 @@
top
:
20%
;
top
:
20%
;
right
:
5%
;
right
:
5%
;
}
}
.row-table
{
.row-table
{
color
:
black
;
color
:
black
;
padding
:
50
px
;
padding
:
15
px
;
margin
:
30px
;
margin
:
15px
;
text-align
:
center
;
text-align
:
center
;
border
:
2
px
solid
red
;
border
:
1
px
solid
red
;
}
}
table
{
.city-banner
{
width
:
100%
;
background
:
linear-gradient
(
to
top
,
#33ccff
0%
,
#006600
100%
);
font-size
:
38px
;
text-align
:
center
;
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
;
}
}
app/controllers/jobs_controller.rb
View file @
c18c0034
class
JobsController
<
ApplicationController
class
JobsController
<
ApplicationController
def
index
end
end
end
app/controllers/top_pages_controller.rb
View file @
c18c0034
...
@@ -4,6 +4,5 @@ class TopPagesController < ApplicationController
...
@@ -4,6 +4,5 @@ class TopPagesController < ApplicationController
@jobs
=
Job
.
limit
(
5
).
order
(
created_at: :desc
)
@jobs
=
Job
.
limit
(
5
).
order
(
created_at: :desc
)
@jobs_of_cities
=
CityJob
.
limit
(
9
).
group
(
'city_id'
).
order
(
'Count(*) DESC'
).
count
@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
@jobs_of_industries
=
IndustryJob
.
limit
(
9
).
group
(
'industry_id'
).
order
(
'Count(*) DESC'
).
count
@index
=
0
end
end
end
end
app/views/layouts/_show_cities.html.erb
View file @
c18c0034
<%
@jobs_of_cities
.
each
do
|
city
,
count_job
|
%>
<%
@jobs_of_cities
.
each
do
|
city
,
count_job
|
%>
<%
@index
+=
1
%>
<div
class=
"col-4"
>
<%
if
@index
%
3
==
0
%>
<div
class=
"row-table"
>
<td
class=
"row-table"
>
<div
class=
"city-name"
><strong>
<%=
City
.
find
(
city
).
name
%>
</strong></div>
<div
class=
"city-name"
><strong>
<%=
City
.
find
(
city
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
</div>
</tr>
</div>
<%
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
%>
<%
end
%>
<%
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
|
%>
<%
@jobs_of_industries
.
each
do
|
industry
,
count_job
|
%>
<%
@index
+=
1
%>
<div
class=
"col-4"
>
<%
if
@index
%
3
==
0
%>
<div
class=
"row-table"
>
<td
class=
"row-table"
>
<div
class=
"industry-name"
><strong>
<%=
Industry
.
find
(
industry
).
name
%>
</strong></div>
<div
class=
"industry-name"
><strong>
<%=
Industry
.
find
(
industry
).
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
<div
class=
"count-job"
>
<%=
count_job
%>
</div>
</td>
</div>
</tr>
</div>
<%
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
%>
<%
end
%>
app/views/layouts/_show_jobs.html.erb
View file @
c18c0034
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<%=
city
.
name
%>
<%=
city
.
name
%>
<%
end
%>
<%
end
%>
</div>
</div>
<%
job
.
description
.
html_safe
%>
<button
type=
"button"
class=
"btn btn-primary"
id=
"button-follow"
>
♥ Follow
</button>
<button
type=
"button"
class=
"btn btn-primary"
id=
"button-follow"
>
♥ Follow
</button>
</div>
</div>
</div>
</div>
...
...
app/views/top_pages/index.html.erb
View file @
c18c0034
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
</div>
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"job-list"
>
<%=
render
'layouts/show_jobs'
%>
</div>
<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>
<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
...
@@ -60,8 +60,8 @@ class Crawler
end
end
def
crawl_job_relationships
def
crawl_job_relationships
(
1
..
10
).
each
do
|
n
|
#
(1..10).each do |n|
page_access
=
Nokogiri
::
HTML
(
URI
.
open
(
"https://careerbuilder.vn/viec-lam/tat-ca-viec-lam-trang-
#{
n
}
-vi.html"
))
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
=
page_access
.
css
(
'a.job_link'
).
map
{
|
link
|
link
[
'href'
]
}
get_link
.
each
do
|
link
|
get_link
.
each
do
|
link
|
page_job
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
parse
(
URI
.
escape
(
link
))))
page_job
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
parse
(
URI
.
escape
(
link
))))
...
@@ -114,7 +114,7 @@ class Crawler
...
@@ -114,7 +114,7 @@ class Crawler
end
end
end
end
end
end
end
#
end
end
end
def
get_file_csv
def
get_file_csv
...
...
lib/src/crontab.rb
View file @
c18c0034
...
@@ -44,7 +44,7 @@ class Crontab
...
@@ -44,7 +44,7 @@ class Crontab
experience
=
get_row
.
at_xpath
(
'//li[./strong/i[contains(@class, "fa fa-briefcase")]]/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
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
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
,
job
=
Job
.
create!
(
title:
title_job
,
level:
level
,
level:
level
,
salary:
salary
,
salary:
salary
,
...
@@ -76,7 +76,8 @@ class Crontab
...
@@ -76,7 +76,8 @@ class Crontab
end
end
end
end
rescue
StandardError
=>
e
rescue
StandardError
=>
e
@mylogger
.
error
"
#{
e
.
message
}
"
# @mylogger.error "#{e.message}"
puts
e
end
end
end
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