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
e70e49e8
Commit
e70e49e8
authored
Aug 10, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Job list and Job detail
parent
36463e25
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
40 additions
and
19 deletions
+40
-19
app/assets/stylesheets/top_pages.scss
+11
-1
app/common/convert.rb
+0
-4
app/controllers/cities_controller.rb
+0
-2
app/controllers/jobs_controller.rb
+4
-0
app/models/city.rb
+4
-0
app/models/company.rb
+1
-1
app/models/industry.rb
+1
-5
app/models/job.rb
+1
-1
app/views/cities/_vietnam.html.erb
+1
-1
app/views/cities/index.html.erb
+2
-2
app/views/jobs/_job.html.erb
+5
-1
app/views/jobs/access_jobs.html.erb
+3
-0
app/views/layouts/_show_job.html.erb
+5
-1
config/routes.rb
+1
-0
lib/src/crawler.rb
+1
-0
No files found.
app/assets/stylesheets/top_pages.scss
View file @
e70e49e8
...
@@ -121,5 +121,15 @@
...
@@ -121,5 +121,15 @@
border
:
2px
solid
#006080
;
border
:
2px
solid
#006080
;
border-radius
:
12px
;
border-radius
:
12px
;
text-align
:
center
;
text-align
:
center
;
font-size
:
32px
;
font-size
:
20px
;
font-family
:
Bookman
,
URW
Bookman
L
,
serif
;
}
.job-details
.title
a
{
color
:
black
;
text-decoration
:
none
;
}
.job-details
.title
a
:hover
{
color
:
#e6b800
;
transition
:
1s
;
text-decoration
:
none
;
}
}
app/common/convert.rb
View file @
e70e49e8
...
@@ -2,8 +2,4 @@ module Convert
...
@@ -2,8 +2,4 @@ module Convert
def
self
.
to_convert
(
str
)
def
self
.
to_convert
(
str
)
str
.
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
str
.
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
end
end
def
self
.
to_convert_name
(
name
)
name
.
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+0-9]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
end
end
end
app/controllers/cities_controller.rb
View file @
e70e49e8
class
CitiesController
<
ApplicationController
class
CitiesController
<
ApplicationController
VIETNAM
=
1
FOREIGN
=
0
def
index
def
index
@cities_vietnam
=
City
.
location
(
City
::
VIETNAM
)
@cities_vietnam
=
City
.
location
(
City
::
VIETNAM
)
@cities_international
=
City
.
location
(
City
::
FOREIGN
)
@cities_international
=
City
.
location
(
City
::
FOREIGN
)
...
...
app/controllers/jobs_controller.rb
View file @
e70e49e8
...
@@ -17,6 +17,10 @@ class JobsController < ApplicationController
...
@@ -17,6 +17,10 @@ class JobsController < ApplicationController
@result_for_job
=
@industry
.
jobs
.
count
@result_for_job
=
@industry
.
jobs
.
count
end
end
def
access_jobs
@job_details
=
Job
.
find
(
params
[
:id
])
end
def
use_variables
def
use_variables
@cities
=
City
.
all
@cities
=
City
.
all
@industries
=
Industry
.
all
@industries
=
Industry
.
all
...
...
app/models/city.rb
View file @
e70e49e8
...
@@ -8,4 +8,8 @@ class City < ApplicationRecord
...
@@ -8,4 +8,8 @@ class City < ApplicationRecord
scope
:top_city
,
->
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
limit
(
9
)
}
scope
:top_city
,
->
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
limit
(
9
)
}
scope
:location
,
->
(
number
)
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
where
(
location:
number
)
}
scope
:location
,
->
(
number
)
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
where
(
location:
number
)
}
def
convert_city
self
.
converted_name
=
Convert
.
to_convert
(
"
#{
name
}
#{
rand
(
10000
)
}
"
)
end
end
end
app/models/company.rb
View file @
e70e49e8
...
@@ -3,6 +3,6 @@ class Company < ApplicationRecord
...
@@ -3,6 +3,6 @@ class Company < ApplicationRecord
has_many
:jobs
has_many
:jobs
def
convert_company
def
convert_company
self
.
converted_name
=
Convert
.
to_convert
(
"
#{
name
}
"
)
self
.
converted_name
=
Convert
.
to_convert
(
"
#{
name
}
#{
rand
(
10000
)
}
"
)
end
end
end
end
app/models/industry.rb
View file @
e70e49e8
...
@@ -7,10 +7,6 @@ class Industry < ApplicationRecord
...
@@ -7,10 +7,6 @@ class Industry < ApplicationRecord
scope
:all_industry
,
->
{
joins
(
:jobs
).
group
(
:industry_id
).
order
(
'count(job_id) DESC'
)
}
scope
:all_industry
,
->
{
joins
(
:jobs
).
group
(
:industry_id
).
order
(
'count(job_id) DESC'
)
}
def
convert_industry
def
convert_industry
converted_name
=
Convert
.
to_convert
(
"
#{
name
}
"
)
self
.
converted_name
=
Convert
.
to_convert
(
"
#{
name
}
#{
rand
(
10000
)
}
"
)
end
def
convert_name
converted_name
=
Convert
.
to_convert_name
(
"
#{
name
}
"
)
end
end
end
end
app/models/job.rb
View file @
e70e49e8
...
@@ -20,7 +20,7 @@ class Job < ApplicationRecord
...
@@ -20,7 +20,7 @@ class Job < ApplicationRecord
scope
:all_job
,
->
{
limit
(
20
).
order
(
created_at: :desc
)
}
scope
:all_job
,
->
{
limit
(
20
).
order
(
created_at: :desc
)
}
def
convert_job
def
convert_job
converted_name
=
Convert
.
to_convert
(
"
#{
title
}
"
)
converted_name
=
Convert
.
to_convert
(
"
#{
title
}
#{
rand
(
10000
)
}
"
)
end
end
def
company_name
def
company_name
...
...
app/views/cities/_vietnam.html.erb
View file @
e70e49e8
<div
class=
"col-3 remove-decoration"
>
<div
class=
"col-3 remove-decoration"
>
<%=
link_to
city_jobs_path
(
converted_name:
city
.
convert_name
)
do
%>
<%=
link_to
city_jobs_path
(
converted_name:
city
.
convert
ed
_name
)
do
%>
<div
class=
"border border-dark rounded international-name"
>
<div
class=
"border border-dark rounded international-name"
>
<div>
<div>
<strong>
<%=
city
.
name
%>
</strong>
<strong>
<%=
city
.
name
%>
</strong>
...
...
app/views/cities/index.html.erb
View file @
e70e49e8
...
@@ -18,13 +18,13 @@
...
@@ -18,13 +18,13 @@
<div
class=
"city-banner rounded vietnam-area"
>
Việt Nam
</div>
<div
class=
"city-banner rounded vietnam-area"
>
Việt Nam
</div>
<div
class=
"city-vietnam"
>
<div
class=
"city-vietnam"
>
<div
class=
"row"
>
<div
class=
"row"
>
<%=
render
partial:
"vietnam"
,
collection:
@
cities_
vietnam
,
as: :city
%>
<%=
render
partial:
"vietnam"
,
collection:
@vietnam
,
as: :city
%>
</div>
</div>
</div>
</div>
<div
class=
"city-banner rounded international-area"
>
International
</div>
<div
class=
"city-banner rounded international-area"
>
International
</div>
<div
class=
"city-international"
>
<div
class=
"city-international"
>
<div
class=
"row"
>
<div
class=
"row"
>
<%=
render
partial:
"international"
,
collection:
@
cities_
international
,
as: :city
%>
<%=
render
partial:
"international"
,
collection:
@international
,
as: :city
%>
</div>
</div>
</div>
</div>
</div>
</div>
app/views/jobs/_job.html.erb
View file @
e70e49e8
<%
if
job
.
cities
.
present?
%>
<%
if
job
.
cities
.
present?
%>
<div
class=
"border border-dark rounded"
>
<div
class=
"border border-dark rounded"
>
<div
class=
"job-details"
>
<div
class=
"job-details"
>
<div
class=
"title"
><strong>
<%=
job
.
title
%>
</strong></div>
<div
class=
"title"
>
<%=
link_to
job_detail_path
(
job
.
id
)
do
%>
<strong>
<%=
job
.
title
%>
</strong>
<%
end
%>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-5"
>
▼
<div
class=
"col-5"
>
▼
<%=
job
.
cities
.
map
(
&
:name
).
join
(
' | '
)
%>
<%=
job
.
cities
.
map
(
&
:name
).
join
(
' | '
)
%>
...
...
app/views/jobs/access_jobs.html.erb
0 → 100644
View file @
e70e49e8
<div
class=
"container"
>
<%=
@job_details
.
title
%>
</div>
app/views/layouts/_show_job.html.erb
View file @
e70e49e8
<%
if
job
.
cities
.
present?
%>
<%
if
job
.
cities
.
present?
%>
<div
class=
"border border-dark rounded"
>
<div
class=
"border border-dark rounded"
>
<div
class=
"job-details"
>
<div
class=
"job-details"
>
<div
class=
"title"
><strong>
<%=
job
.
title
%>
</strong></div>
<div
class=
"title"
>
<%=
link_to
job_detail_path
(
job
.
id
)
do
%>
<strong>
<%=
job
.
title
%>
</strong>
<%
end
%>
</div>
<div>
<%=
job
.
company_name
%>
</div>
<div>
<%=
job
.
company_name
%>
</div>
<div
class=
"salary"
>
💲 Salary:
<%=
job
.
salary
%>
</div>
<div
class=
"salary"
>
💲 Salary:
<%=
job
.
salary
%>
</div>
<div>
▼
<div>
▼
...
...
config/routes.rb
View file @
e70e49e8
...
@@ -3,6 +3,7 @@ Rails.application.routes.draw do
...
@@ -3,6 +3,7 @@ Rails.application.routes.draw do
resources
:jobs
resources
:jobs
get
'jobs/city/:converted_name'
,
to:
'jobs#city_jobs'
,
as: :city_jobs
get
'jobs/city/:converted_name'
,
to:
'jobs#city_jobs'
,
as: :city_jobs
get
'jobs/industry/:converted_name'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
get
'jobs/industry/:converted_name'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
get
'detail/:id'
,
to:
'jobs#access_jobs'
,
as: :job_detail
resources
:top_pages
resources
:top_pages
resources
:industries
resources
:industries
...
...
lib/src/crawler.rb
View file @
e70e49e8
...
@@ -75,6 +75,7 @@ class Crawler
...
@@ -75,6 +75,7 @@ class Crawler
expiration_date:
expiration_date
,
expiration_date:
expiration_date
,
description:
description
,
description:
description
,
company_id:
company
.
id
)
company_id:
company
.
id
)
city_relationship
(
row
,
job
)
city_relationship
(
row
,
job
)
industry_relationship
(
row
,
job
)
industry_relationship
(
row
,
job
)
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