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
c66f5032
Commit
c66f5032
authored
Aug 06, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert url city, industry
parent
629062e1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
7 deletions
+12
-7
app/controllers/jobs_controller.rb
+2
-1
app/models/city.rb
+4
-0
app/views/cities/_cities_international.html.erb
+1
-1
app/views/cities/_cities_vietnam.html.erb
+1
-1
app/views/layouts/_show_cities.html.erb
+1
-1
config/routes.rb
+2
-2
lib/src/csv_importer.rb
+1
-1
No files found.
app/controllers/jobs_controller.rb
View file @
c66f5032
class
JobsController
<
ApplicationController
def
index
@cities
=
City
.
all
@industries
=
Industry
.
all
...
...
@@ -9,7 +10,7 @@ class JobsController < ApplicationController
def
city_jobs
@cities
=
City
.
all
@industries
=
Industry
.
all
@city
=
City
.
find
(
params
[
:id
])
@city
=
City
.
find
_by
(
name:
params
[
:name
])
@jobs_list
=
@city
.
jobs
.
all_job
.
page
(
params
[
:page
]).
per
(
20
)
@total_job
=
Job
.
count
@result_for_job
=
@city
.
jobs
.
count
...
...
app/models/city.rb
View file @
c66f5032
...
...
@@ -5,4 +5,8 @@ class City < ApplicationRecord
scope
:top_city
,
->
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
limit
(
9
)
}
scope
:vietnam
,
->
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
where
(
'location = 1'
)
}
scope
:international
,
->
{
joins
(
:jobs
).
group
(
:city_id
).
order
(
'count(job_id) DESC'
).
where
(
'location = 0'
)
}
def
convert_name
name
.
mb_chars
.
normalize
(
:kd
).
gsub
(
/[Đđ]/
,
'd'
).
gsub
(
/[^\x00-\x7F]/
,
''
).
gsub
(
/[\W+0-9]/
,
' '
).
downcase
.
to_s
.
split
(
' '
).
join
(
'-'
)
end
end
app/views/cities/_cities_international.html.erb
View file @
c66f5032
<div
class=
"col-3 remove-decoration"
>
<%=
link_to
'#'
do
%>
<%=
link_to
city_jobs_path
(
name:
city
.
name
)
do
%>
<div
class=
"border border-dark rounded vn-name"
>
<div>
<strong>
<%=
city
.
name
%>
</strong>
...
...
app/views/cities/_cities_vietnam.html.erb
View file @
c66f5032
<div
class=
"col-3 remove-decoration"
>
<%=
link_to
city_jobs_path
(
city
.
id
)
do
%>
<%=
link_to
city_jobs_path
(
name:
city
.
convert_name
)
do
%>
<div
class=
"border border-dark rounded international-name"
>
<div>
<strong>
<%=
city
.
name
%>
</strong>
...
...
app/views/layouts/_show_cities.html.erb
View file @
c66f5032
<div
class=
"col-4"
>
<div
class=
"row-table border border-dark rounded city-list"
>
<%=
link_to
city_jobs_path
(
city
.
id
)
do
%>
<%=
link_to
city_jobs_path
(
name:
city
.
name
)
do
%>
<div
class=
"city-name"
><strong>
<%=
city
.
name
%>
</strong></div>
<div
class=
"count-job"
>
<%=
city
.
jobs
.
count
%>
</div>
<%
end
%>
...
...
config/routes.rb
View file @
c66f5032
Rails
.
application
.
routes
.
draw
do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources
:jobs
get
'jobs/cit
ies/:id
'
,
to:
'jobs#city_jobs'
,
as: :city_jobs
get
'jobs/industr
ies
/:id'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
get
'jobs/cit
y/:name
'
,
to:
'jobs#city_jobs'
,
as: :city_jobs
get
'jobs/industr
y
/:id'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
resources
:top_pages
resources
:industries
...
...
lib/src/csv_importer.rb
View file @
c66f5032
...
...
@@ -65,7 +65,7 @@ class CSVImporter
description:
description_job
,
level:
level
,
salary:
salary
,
company_id:
company
_
id
)
do
|
job
|
company_id:
company
.
id
)
do
|
job
|
job
.
industries
<<
industries_relationship
job
.
cities
<<
location_relationship
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