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
Nguyen Hoang Mai Phuong
VeNJOB
Commits
cdbb0669
Commit
cdbb0669
authored
Jul 29, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix page-ID2-ID3
parent
64413466
Pipeline
#1373
failed with stages
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
app/controllers/city_controller.rb
+3
-2
app/models/city.rb
+4
-2
app/views/city/list_city.html.slim
+3
-3
app/views/industry/list_industry.html.slim
+1
-1
config/routes.rb
+3
-4
No files found.
app/controllers/city_controller.rb
View file @
cdbb0669
class
CityController
<
ApplicationController
def
list_city
@cit
y_vietnam
=
City
.
city_vietnam
@cit
y_inter
=
City
.
city_inter
@cit
ies_vietnam
=
City
.
cities
(
City
::
REGION_VN_ID
)
@cit
ies_international
=
City
.
cities
(
City
::
REGION_INTERNATIONAL_ID
)
end
end
\ No newline at end of file
app/models/city.rb
View file @
cdbb0669
...
...
@@ -3,7 +3,8 @@ class City < ApplicationRecord
has_and_belongs_to_many
:jobs
has_and_belongs_to_many
:companies
LATEST_CITY_NUMBER
=
9
REGION_VN_ID
=
1
REGION_INTERNATIONAL_ID
=
2
scope
:top_cities
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_CITY_NUMBER
)
}
scope
:city_vietnam
,
->
{
joins
(
:jobs
).
group
(
:name
).
having
(
'count_all >= ?'
,
1
).
where
(
'region_id = 1'
).
order
(
'count_all DESC'
).
count
}
scope
:city_inter
,
->
{
joins
(
:jobs
).
group
(
:name
).
having
(
'count_all >= ?'
,
1
).
where
(
'region_id = 2'
).
order
(
'count_all DESC'
).
count
}
scope
:cities
,
->
(
value
)
{
joins
(
:jobs
).
group
(
:name
).
having
(
'count_all >= ?'
,
1
).
where
(
"region_id =
#{
value
}
"
).
order
(
'count_all DESC'
).
count
}
end
\ No newline at end of file
app/views/city/list_city.html.slim
View file @
cdbb0669
-
provide
:title
,
'Cit
ies
'
-
provide
:title
,
'Cit
y List
'
.container
h3
.p-3
...
...
@@ -12,7 +12,7 @@
h3
|
Việt Nam
.row.my-3.text-center.fs-5
-
@cit
y
_vietnam
.
each
do
|
name
,
amount
|
-
@cit
ies
_vietnam
.
each
do
|
name
,
amount
|
.col-3.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
"#"
p
.mb-1
...
...
@@ -21,7 +21,7 @@
h3
|
International
.row.my-3.text-center.fs-5
-
@cit
y_inter
.
each
do
|
name
,
amount
|
-
@cit
ies_international
.
each
do
|
name
,
amount
|
.col-3.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
"#"
p
.mb-1
...
...
app/views/industry/list_industry.html.slim
View file @
cdbb0669
-
provide
:title
,
'Industr
ies
'
-
provide
:title
,
'Industr
y List
'
.container
h3
.p-3
...
...
config/routes.rb
View file @
cdbb0669
Rails
.
application
.
routes
.
draw
do
root
'top#home'
get
'/cities'
,
to:
'city#list_city'
get
'/industries'
,
to:
'industry#list_industry'
resource
:cities
resource
:industries
get
'cities'
,
to:
'city#list_city'
get
'industries'
,
to:
'industry#list_industry'
end
\ No newline at end of file
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