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
56de9774
Commit
56de9774
authored
Aug 03, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix view ID4
parent
e25c9b9b
Pipeline
#1378
failed with stages
in 0 seconds
Changes
12
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
52 additions
and
26 deletions
+52
-26
app/assets/stylesheets/custom.scss
+14
-0
app/controllers/jobs_controller.rb
+4
-3
app/controllers/top_controller.rb
+3
-2
app/models/city.rb
+5
-4
app/models/industry.rb
+6
-4
app/models/job.rb
+2
-1
app/views/cities/show.html.slim
+3
-2
app/views/industries/show.html.slim
+2
-1
app/views/jobs/_search.html.slim
+2
-4
app/views/jobs/show.html.slim
+8
-2
app/views/top/home.html.slim
+2
-2
config/initializers/kaminari_config.rb
+1
-1
No files found.
app/assets/stylesheets/custom.scss
View file @
56de9774
...
@@ -43,3 +43,17 @@
...
@@ -43,3 +43,17 @@
.form
{
.form
{
width
:
700px
width
:
700px
}
}
.card-body
{
float
:
left
;
}
.favourite
{
float
:
right
;
.btn
{
height
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
app/controllers/jobs_controller.rb
View file @
56de9774
...
@@ -2,10 +2,10 @@ class JobsController < ApplicationController
...
@@ -2,10 +2,10 @@ class JobsController < ApplicationController
def
show
def
show
if
params
[
:city_slug
].
present?
if
params
[
:city_slug
].
present?
@city
=
City
.
find_by
(
slug:
params
[
:city_slug
])
@city
=
City
.
find_by
(
slug:
params
[
:city_slug
])
@jobs
=
@city
.
jobs
.
order
(
created_at: :desc
).
page
(
params
[
:page
]).
per
(
20
)
@jobs
=
@city
.
jobs
.
latest_jobs
.
page
(
params
[
:page
]
)
els
if
params
[
:industry_slug
].
present?
els
e
@industry
=
Industry
.
find_by
(
slug:
params
[
:industry_slug
])
@industry
=
Industry
.
find_by
(
slug:
params
[
:industry_slug
])
@jobs
=
@industry
.
jobs
.
order
(
created_at: :desc
).
page
(
params
[
:page
]).
per
(
20
)
@jobs
=
@industry
.
jobs
.
latest_jobs
.
page
(
params
[
:page
])
end
end
end
end
end
end
\ No newline at end of file
app/controllers/top_controller.rb
View file @
56de9774
class
TopController
<
ApplicationController
class
TopController
<
ApplicationController
def
home
def
home
@jobs
=
Job
.
latest_jobs
@jobs
=
Job
.
latest_jobs
.
limit
(
Job
::
LATEST_JOB_NUMBER
)
@cities
=
City
.
top_cities
@cities
=
City
.
top_cities
@industries
=
Industry
.
top_industries
@industries
=
Industry
.
top_industries
@total_job
=
Job
.
all
.
count
@total_job
=
Job
.
count
end
end
end
end
\ No newline at end of file
app/models/city.rb
View file @
56de9774
class
City
<
ApplicationRecord
class
City
<
ApplicationRecord
extend
FriendlyId
friendly_id
:name
,
use:
%i[slugged finders]
belongs_to
:region
belongs_to
:region
has_and_belongs_to_many
:jobs
has_and_belongs_to_many
:jobs
has_and_belongs_to_many
:companies
has_and_belongs_to_many
:companies
LATEST_CITY_NUMBER
=
9
LATEST_CITY_NUMBER
=
9
REGION_VN_ID
=
1
REGION_VN_ID
=
1
REGION_INTERNATIONAL_ID
=
2
REGION_INTERNATIONAL_ID
=
2
scope
:top_cities
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_CITY_NUMBER
)
}
scope
:cities_by_region
,
->
(
value
)
{
joins
(
:jobs
).
group
(
:name
).
having
(
'count_all >= ?'
,
1
).
where
(
'region_id = ?'
,
value
).
order
(
'count_all DESC'
).
count
}
scope
:top_cities
,
->
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_CITY_NUMBER
)
}
extend
FriendlyId
scope
:cities_by_region
,
->
(
value
)
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
having
(
'count_all >= ?'
,
1
).
where
(
'region_id = ?'
,
value
).
order
(
'count_all DESC'
).
count
}
friendly_id
:name
,
use:
%i[slugged finders]
def
normalize_friendly_id
(
string
)
def
normalize_friendly_id
(
string
)
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
end
end
...
...
app/models/industry.rb
View file @
56de9774
class
Industry
<
ApplicationRecord
class
Industry
<
ApplicationRecord
has_and_belongs_to_many
:jobs
LATEST_INDUSTRY_NUMBER
=
9
scope
:top_industries
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
scope
:industry_list
,
->
{
joins
(
:jobs
).
group
(
:name
).
having
(
'count_all >= ?'
,
1
).
order
(
'count_all DESC'
).
count
}
extend
FriendlyId
extend
FriendlyId
friendly_id
:name
,
use:
%i[slugged finders]
friendly_id
:name
,
use:
%i[slugged finders]
has_and_belongs_to_many
:jobs
LATEST_INDUSTRY_NUMBER
=
9
scope
:top_industries
,
->
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
scope
:industry_list
,
->
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
having
(
'count_all >= ?'
,
1
).
order
(
'count_all DESC'
).
count
}
def
normalize_friendly_id
(
string
)
def
normalize_friendly_id
(
string
)
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
end
end
...
...
app/models/job.rb
View file @
56de9774
...
@@ -6,5 +6,5 @@ class Job < ApplicationRecord
...
@@ -6,5 +6,5 @@ class Job < ApplicationRecord
has_and_belongs_to_many
:industries
has_and_belongs_to_many
:industries
has_and_belongs_to_many
:cities
has_and_belongs_to_many
:cities
LATEST_JOB_NUMBER
=
5
LATEST_JOB_NUMBER
=
5
scope
:latest_jobs
,
->
{
includes
(
:cities
,
:
company
).
order
(
'created_at DESC'
).
limit
(
LATEST_JOB_NUMBER
)
}
scope
:latest_jobs
,
->
{
includes
(
:cities
,
:
industries
,
:company
).
order
(
'created_at DESC'
)
}
end
end
\ No newline at end of file
app/views/cities/show.html.slim
View file @
56de9774
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
.row.my-3.text-center.fs-5
.row.my-3.text-center.fs-5
-
@cities_vietnam
.
each
do
|
name
,
amount
|
-
@cities_vietnam
.
each
do
|
name
,
amount
|
.col-3.p-2.border.mb-1.fw-normal.bg-white
.col-3.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
city_slug_path
(
City
.
find_by
(
name:
name
)
)
=
link_to
name
[
0
],
city_slug_path
(
name
[
1
]
)
p
.mb-1
p
.mb-1
=
amount
=
amount
#international
#international
...
@@ -23,6 +23,6 @@
...
@@ -23,6 +23,6 @@
.row.my-3.text-center.fs-5
.row.my-3.text-center.fs-5
-
@cities_international
.
each
do
|
name
,
amount
|
-
@cities_international
.
each
do
|
name
,
amount
|
.col-3.p-2.border.mb-1.fw-normal.bg-white
.col-3.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
city_slug_path
(
City
.
find_by
(
name:
name
)
)
=
link_to
name
[
0
],
city_slug_path
(
name
[
1
]
)
p
.mb-1
p
.mb-1
=
amount
=
amount
\ No newline at end of file
app/views/industries/show.html.slim
View file @
56de9774
...
@@ -6,6 +6,6 @@
...
@@ -6,6 +6,6 @@
.row.my-3.text-center.fs-5
.row.my-3.text-center.fs-5
-
@industry_list
.
each
do
|
name
,
amount
|
-
@industry_list
.
each
do
|
name
,
amount
|
.col-3.p-2.border.mb-1.fw-normal.bg-white
.col-3.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
industry_slug_path
(
Industry
.
friendly
.
find_by
(
name:
name
)
)
=
link_to
name
[
0
],
industry_slug_path
(
name
[
1
]
)
p
.mb-1
p
.mb-1
=
amount
=
amount
\ No newline at end of file
app/views/jobs/_search.html.slim
View file @
56de9774
.search.p-3.offset-md-2
.search.p-3.offset-md-2
=
form_with
(
url:
'/
search
'
,
method:
'get'
,
local:
true
)
do
=
form_with
(
url:
'/
jobs
'
,
method:
'get'
,
local:
true
)
do
=
text_field_tag
:search
,
params
[
:search
],
placeholder:
"Search"
,
class:
"form"
=
text_field_tag
:search
,
params
[
:search
],
placeholder:
"Search"
,
class:
"form"
=
submit_tag
"Search"
,
name:
nil
,
class:
'btn-primary'
=
submit_tag
"Search"
,
name:
nil
,
class:
'btn-primary'
\ No newline at end of file
app/views/jobs/show.html.slim
View file @
56de9774
...
@@ -2,12 +2,16 @@
...
@@ -2,12 +2,16 @@
=
render
'search'
=
render
'search'
.container
.container
h5
.fw-normal
|
Total:
h5
.fw-normal
|
Result for:
h6
.offset-md-4
h6
.offset-md-4
=
paginate
@jobs
,
window:
1
=
paginate
@jobs
,
window:
1
.job-list
.job-list
-
@jobs
.
each
do
|
job
|
-
@jobs
.
each
do
|
job
|
.
card.my-3
.
row.bg-white
.card-body.text-dark
.c
ol-10.p-3.border.c
ard-body.text-dark
h5
.mb-1
h5
.mb-1
=
link_to
job
.
title
,
"#"
=
link_to
job
.
title
,
"#"
p
.mb-1
p
.mb-1
...
@@ -21,6 +25,8 @@
...
@@ -21,6 +25,8 @@
=
link_to
job
.
cities
.
map
(
&
:name
).
uniq
.
join
(
' | '
),
"#"
=
link_to
job
.
cities
.
map
(
&
:name
).
uniq
.
join
(
' | '
),
"#"
p
.mb-1
p
.mb-1
=
truncate
(
job
.
overview
,
length:
250
)
=
truncate
(
job
.
overview
,
length:
250
)
.col-sm-2.p-3.border.favourite
=
link_to
"Farourite"
,
"#"
,
class:
"btn btn-outline-primary"
h6
.offset-md-4.px-5
h6
.offset-md-4.px-5
=
page_entries_info
@jobs
=
page_entries_info
@jobs
h6
.offset-md-4
h6
.offset-md-4
...
...
app/views/top/home.html.slim
View file @
56de9774
...
@@ -26,7 +26,7 @@ h3.p-2
...
@@ -26,7 +26,7 @@ h3.p-2
.row.my-3.text-center.fs-5
.row.my-3.text-center.fs-5
-
@cities
.
each
do
|
name
,
amount
|
-
@cities
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1.fw-normal.bg-white
.col-4.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
city_slug_path
(
City
.
find_by
(
name:
name
))
=
link_to
name
[
0
],
city_slug_path
(
name
[
1
])
p
.mb-1
p
.mb-1
=
amount
=
amount
.d-flex.flex-row-reverse.
.d-flex.flex-row-reverse.
...
@@ -36,7 +36,7 @@ h3.p-2
...
@@ -36,7 +36,7 @@ h3.p-2
.row.my-3.text-center.fs-5
.row.my-3.text-center.fs-5
-
@industries
.
each
do
|
name
,
amount
|
-
@industries
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1.fw-normal.bg-white
.col-4.p-2.border.mb-1.fw-normal.bg-white
=
link_to
name
,
industry_slug_path
(
Industry
.
find_by
(
name:
name
))
=
link_to
name
[
0
],
industry_slug_path
(
name
[
1
])
p
.mb-1
p
.mb-1
=
amount
=
amount
.d-flex.flex-row-reverse
.d-flex.flex-row-reverse
...
...
config/initializers/kaminari_config.rb
View file @
56de9774
# frozen_string_literal: true
# frozen_string_literal: true
Kaminari
.
configure
do
|
config
|
Kaminari
.
configure
do
|
config
|
# config.default_per_page = 25
config
.
default_per_page
=
20
# config.max_per_page = nil
# config.max_per_page = nil
# config.window = 4
# config.window = 4
# config.outer_window = 0
# config.outer_window = 0
...
...
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