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
Mai Hoang Thai Ha
VenJob
Commits
0e3f626d
Commit
0e3f626d
authored
Aug 09, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed model and view
parent
7a1e0d6f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
42 deletions
+14
-42
app/assets/stylesheets/custom.scss
+4
-15
app/assets/stylesheets/top.scss
+2
-13
app/controllers/top_controller.rb
+2
-2
app/models/city.rb
+1
-2
app/models/industry.rb
+1
-6
app/views/cities/index.html.slim
+2
-2
app/views/top/index.html.slim
+2
-2
No files found.
app/assets/stylesheets/custom.scss
View file @
0e3f626d
// @import "bootstrap";
// @import "bootstrap";
$white
:
#fff
;
$gray-100
:
#f8f9fa
;
$gray-200
:
#e9ecef
;
$gray-300
:
#dee2e6
;
$gray-400
:
#ced4da
;
$gray-500
:
#adb5bd
;
$gray-600
:
#6c757d
;
$gray-700
:
#495057
;
$gray-800
:
#343a40
;
$gray-900
:
#212529
;
$black
:
#000
;
// reset css
// reset css
*
{
*
{
...
@@ -34,12 +23,12 @@ header {
...
@@ -34,12 +23,12 @@ header {
li
{
li
{
margin-left
:
18px
;
margin-left
:
18px
;
a
{
a
{
color
:
$gray-400
;
color
:
#ced4da
;
font-size
:
18px
;
font-size
:
18px
;
text-decoration
:
none
;
text-decoration
:
none
;
font-weight
:
500
;
font-weight
:
500
;
&
:hover
{
&
:hover
{
color
:
$white
;
color
:
#fff
;
}
}
}
}
}
}
...
@@ -58,9 +47,9 @@ footer {
...
@@ -58,9 +47,9 @@ footer {
color
:
#777
;
color
:
#777
;
a
{
a
{
text-decoration
:none
;
text-decoration
:none
;
color
:
$gray-600
;
color
:
#6c757d
;
&
:hover
{
&
:hover
{
color
:
$gray-900
;
color
:
#212529
;
}
}
}
}
small
{
small
{
...
...
app/assets/stylesheets/top.scss
View file @
0e3f626d
$white
:
#fff
;
$gray-100
:
#f8f9fa
;
$gray-200
:
#e9ecef
;
$gray-300
:
#dee2e6
;
$gray-400
:
#ced4da
;
$gray-500
:
#adb5bd
;
$gray-600
:
#6c757d
;
$gray-700
:
#495057
;
$gray-800
:
#343a40
;
$gray-900
:
#212529
;
$black
:
#000
;
// Top page
// Top page
// search
// search
...
@@ -29,7 +18,7 @@ $black: #000;
...
@@ -29,7 +18,7 @@ $black: #000;
.job-company
{
.job-company
{
text-decoration
:
none
;
text-decoration
:
none
;
font-size
:
14px
;
font-size
:
14px
;
color
:
$gray-700
;
color
:
#495057
;
}
}
.job-salary
{
.job-salary
{
color
:
#008563
;
color
:
#008563
;
...
@@ -40,7 +29,7 @@ $black: #000;
...
@@ -40,7 +29,7 @@ $black: #000;
list-style
:
none
;
list-style
:
none
;
margin
:
0
0
6px
0
;
margin
:
0
0
6px
0
;
padding
:
0
;
padding
:
0
;
color
:
$gray-700
;
color
:
#495057
;
}
}
}
}
.job-desc
{
.job-desc
{
...
...
app/controllers/top_controller.rb
View file @
0e3f626d
...
@@ -2,7 +2,7 @@ class TopController < ApplicationController
...
@@ -2,7 +2,7 @@ class TopController < ApplicationController
def
index
def
index
@total_job
=
Job
.
count
@total_job
=
Job
.
count
@latest_jobs
=
Job
.
latest
@latest_jobs
=
Job
.
latest
@top_cities
=
City
.
top_jobs
@top_cities
=
City
.
top_jobs
.
take
(
City
::
TOP_JOB_COUNT
)
@top_industries
=
Industry
.
top_jobs
@top_industries
=
Industry
.
job_quantity_by_industry
.
take
(
Industry
::
TOP_JOB_COUNT
)
end
end
end
end
app/models/city.rb
View file @
0e3f626d
...
@@ -8,8 +8,7 @@ class City < ApplicationRecord
...
@@ -8,8 +8,7 @@ class City < ApplicationRecord
validates
:slug
,
presence:
true
,
uniqueness:
{
case_sensitive:
true
}
validates
:slug
,
presence:
true
,
uniqueness:
{
case_sensitive:
true
}
def
self
.
top_jobs
def
self
.
top_jobs
joins
(
:jobs
).
select
(
'cities.*, count(jobs.id) as job_count'
)
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'COUNT(jobs.id) DESC'
).
count
.
group
(
'cities.id'
).
order
(
'job_count desc'
).
limit
(
TOP_JOB_COUNT
)
end
end
def
self
.
job_quantity_by_region
def
self
.
job_quantity_by_region
...
...
app/models/industry.rb
View file @
0e3f626d
...
@@ -5,12 +5,7 @@ class Industry < ApplicationRecord
...
@@ -5,12 +5,7 @@ class Industry < ApplicationRecord
validates
:slug
,
presence:
true
,
uniqueness:
{
case_sensitive:
true
}
validates
:slug
,
presence:
true
,
uniqueness:
{
case_sensitive:
true
}
def
self
.
top_jobs
joins
(
:jobs
).
select
(
'industries.*, count(jobs.id) as job_count'
)
.
group
(
'industries.id'
).
order
(
'job_count desc'
).
limit
(
TOP_JOB_COUNT
)
end
def
self
.
job_quantity_by_industry
def
self
.
job_quantity_by_industry
Industry
.
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'COUNT(jobs.id) DESC'
).
count
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'COUNT(jobs.id) DESC'
).
count
end
end
end
end
app/views/cities/index.html.slim
View file @
0e3f626d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
-
@regions
.
each
do
|
region
|
-
@regions
.
each
do
|
region
|
.col-lg-4.col-md-6.text-center
.col-lg-4.col-md-6.text-center
.mt-5
.mt-5
h3
.h4.mb-2.text-white.see-more-text
=
link_to
region
,
anchor:
region
h3
.h4.mb-2.text-white.see-more-text
=
link_to
region
.
upcase
,
anchor:
region
// cities list
// cities list
.cities-list
.cities-list
.container
.container
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
.countries-job-list
id
=
region
.countries-job-list
id
=
region
.container-fullwidth.py-5
.container-fullwidth.py-5
h2
.mt-0
h2
.mt-0
=
region
=
region
.
upcase
hr
.my-4
hr
.my-4
.row
.row
-
city_job_count
.
each
do
|
city
,
count
|
-
city_job_count
.
each
do
|
city
,
count
|
...
...
app/views/top/index.html.slim
View file @
0e3f626d
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
.row.align-items-start.mb-3
.row.align-items-start.mb-3
-
@top_cities
.
each
do
|
city
,
city_jobs
|
-
@top_cities
.
each
do
|
city
,
city_jobs
|
.col-4.city-item
.col-4.city-item
=
link_to
city
.
name
,
job_list_path
(
model: :city
,
slug:
city
.
slug
),
class:
'city-name'
=
link_to
city
[
0
],
job_list_path
(
model: :city
,
slug:
city
[
1
]
),
class:
'city-name'
span
.job-count
span
.job-count
|
(
|
(
=
pluralize
(
city_jobs
,
'job'
)
=
pluralize
(
city_jobs
,
'job'
)
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
.row.align-items-start
.row.align-items-start
-
@top_industries
.
each
do
|
industry
,
industry_jobs
|
-
@top_industries
.
each
do
|
industry
,
industry_jobs
|
.col-4.industry-item
.col-4.industry-item
=
link_to
industry
.
name
,
job_list_path
(
model: :industry
,
slug:
industry
.
slug
),
class:
'industry-name'
=
link_to
industry
[
0
],
job_list_path
(
model: :industry
,
slug:
industry
[
1
]
),
class:
'industry-name'
span
.job-count
span
.job-count
|
(
|
(
=
pluralize
(
industry_jobs
,
'job'
)
=
pluralize
(
industry_jobs
,
'job'
)
...
...
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