Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_nth
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
3
Merge Requests
3
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
Ngô Trung Hưng
venjob_nth
Commits
c5eb1f47
Commit
c5eb1f47
authored
Aug 05, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
..
parent
c4c3b235
Pipeline
#810
failed with stages
in 0 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
27 deletions
+36
-27
app/controllers/job_controller.rb
+4
-19
app/service/slug.rb
+25
-0
app/views/city/_block_city_jobs.html.erb
+1
-1
app/views/home/_box_nine_city.html.erb
+2
-2
app/views/home/_box_nine_industries.html.erb
+2
-2
app/views/industry/_block_industry.html.erb
+1
-1
config/routes.rb
+1
-2
No files found.
app/controllers/job_controller.rb
View file @
c5eb1f47
...
...
@@ -2,26 +2,11 @@
# Job controller
class
JobController
<
ApplicationController
before_action
:load_data_dropdown
,
only:
%i[find_jobs_by_industry find_jobs_by_city find_jobs_by_company]
before_action
:load_data_dropdown
,
only:
:index
def
find_jobs_by_city
city
=
City
.
find
(
params
[
:key_city
])
result
(
city
)
end
def
find_jobs_by_industry
industry
=
Industry
.
find
(
params
[
:key_industry
])
result
(
industry
)
end
def
find_jobs_by_company
company
=
Company
.
find
(
params
[
:key_company
])
result
(
company
)
end
def
find_jobs
d
=
params
[
:model
].
capitalize
obj
=
.
find
(
params
[
:id
])
def
index
model
=
Object
.
const_get
(
params
[
:model
].
capitalize
)
obj
=
model
.
find
(
params
[
:id
])
result
(
obj
)
end
...
...
app/service/slug.rb
0 → 100644
View file @
c5eb1f47
module
Slug
def
to_slug
(
str
)
str
=
str
.
to_s
.
strip
.
downcase
accents
=
{
%w[à á ạ ả ã â ầ ấ ậ ẩ ẫ ă ằ ắ ặ ẳ ẵ]
=>
'a'
,
%w[è é ẹ ẻ ẽ ê ề ế ệ ể ễ]
=>
'e'
,
%w[ì í ị ỉ ĩ]
=>
'i'
,
%w[ò ó ọ ỏ õ ô ồ ố ộ ổ ỗ ơ ờ ớ ợ ở ỡ]
=>
'o'
,
%w[ù ú ụ ủ ũ ư ừ ứ ự ử ữ]
=>
'u'
,
%w[ỳ ý ỵ ỷ ỹ]
=>
'y'
,
%w[đ]
=>
'd'
}
accents
.
each
do
|
ac
,
rep
|
ac
.
each
do
|
s
|
str
=
str
.
tr
(
s
,
rep
)
end
end
str
=
str
.
gsub
(
/[^a-zA-Z0-9 ]/
,
''
)
str
=
str
.
gsub
(
/[ ]+/
,
' '
)
str
.
tr
(
' '
,
'-'
)
end
end
\ No newline at end of file
app/views/city/_block_city_jobs.html.erb
View file @
c5eb1f47
...
...
@@ -2,7 +2,7 @@
<div
class=
"col-lg-3 col-md-4"
>
<div
class=
"box_cityjobs"
>
<div
class=
"box_cityjobs_name"
>
<%=
link_to
city
.
name
,
"/jobs/city/
#{
city
.
id
}
"
,
class:
'cityjobs_link'
%>
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
id:
city
.
id
)
,
class:
'cityjobs_link'
%>
</div>
<div
class=
"box_cityjobs_count"
>
<span>
<%=
city
.
jobs
.
count
%>
Công việc
</span>
...
...
app/views/home/_box_nine_city.html.erb
View file @
c5eb1f47
...
...
@@ -9,10 +9,10 @@
<div
class=
"box_info_city"
>
<div
class=
"ct_name"
>
<!--
<%=
link_to
city
.
name
,
"/jobs/city/
#{
city
.
id
}
"
,
class:
'link_ct'
%>
-->
<%=
link_to
city
.
name
,
"/jobs/city/
#{
city
.
id
}
"
,
class:
'link_ct'
%>
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
id:
city
.
id
)
,
class:
'link_ct'
%>
</div>
<div
class=
"ct_jobs_count"
>
<%=
link_to
"
#{
city
.
jobs
.
count
}
công việc"
,
"/jobs/city/
#{
city
.
id
}
"
,
class:
'link_ct'
%>
<%=
link_to
"
#{
city
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'city'
,
id:
city
.
id
)
,
class:
'link_ct'
%>
</div>
</div>
</div>
...
...
app/views/home/_box_nine_industries.html.erb
View file @
c5eb1f47
...
...
@@ -8,10 +8,10 @@
<div
class=
"col-lg-4 col-md-4 col-sm-6 col-xs-12"
>
<div
class=
"box_info_city"
>
<div
class=
"ct_name"
>
<%=
link_to
industry
.
name
,
"/jobs/industry/
#{
industry
.
id
}
"
,
class:
'link_ct'
%>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
)
,
class:
'link_ct'
%>
</div>
<div
class=
"ct_jobs_count"
>
<%=
link_to
"
#{
industry
.
jobs
.
count
}
công việc"
,
"/jobs/industry/
#{
industry
.
id
}
"
,
class:
'link_ct'
%>
<%=
link_to
"
#{
industry
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
)
,
class:
'link_ct'
%>
</div>
</div>
</div>
...
...
app/views/industry/_block_industry.html.erb
View file @
c5eb1f47
<div
class=
"col-lg-3 col-md-4"
>
<div
class=
"box_cityjobs"
>
<div
class=
"box_cityjobs_name"
>
<%=
link_to
industry
.
name
,
"/jobs/industry/
#{
industry
.
id
}
"
,
class:
'cityjobs_link'
%>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
)
,
class:
'cityjobs_link'
%>
</div>
<div
class=
"box_cityjobs_count"
>
<span>
<%=
industry
.
jobs
.
count
%>
Công việc
</span>
...
...
config/routes.rb
View file @
c5eb1f47
...
...
@@ -6,6 +6,5 @@ Rails.application.routes.draw do
get
'city/index'
# Search
get
'jobs/:model/:id'
,
to:
'job#find_jobs'
get
'jobs/:model/:id'
,
to:
'job#index'
,
as: :jobs
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