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 Ngoc Nghia
VeNJOB
Commits
a457a86f
Commit
a457a86f
authored
Dec 19, 2019
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using gem draper
parent
cb04c29f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
7 deletions
+11
-7
app/controllers/jobs_controller.rb
+4
-0
app/controllers/tops_controller.rb
+2
-2
app/decorators/job_decorator.rb
+2
-2
app/models/city.rb
+1
-1
app/models/industry.rb
+1
-1
app/views/jobs/show.html.erb
+0
-0
config/routes.rb
+1
-1
No files found.
app/controllers/jobs_controller.rb
View file @
a457a86f
...
@@ -2,4 +2,8 @@ class JobsController < ApplicationController
...
@@ -2,4 +2,8 @@ class JobsController < ApplicationController
def
index
def
index
@jobs
=
Job
.
page
(
params
[
:page
]).
per
(
Settings
.
job
.
per_page
)
@jobs
=
Job
.
page
(
params
[
:page
]).
per
(
Settings
.
job
.
per_page
)
end
end
def
show
@job
=
Job
.
find
(
params
[
:id
])
end
end
end
app/controllers/tops_controller.rb
View file @
a457a86f
class
TopsController
<
ApplicationController
class
TopsController
<
ApplicationController
def
index
def
index
@vn_cities
=
City
.
city_order
.
take
(
Settings
.
top
.
city
.
limit
)
@vn_cities
=
City
.
city_order
@industries
=
Industry
.
industry_order
.
take
(
Settings
.
top
.
city
.
limit
)
@industries
=
Industry
.
industry_order
@jobs
=
Job
.
latest_job
@jobs
=
Job
.
latest_job
end
end
end
end
app/decorators/job_decorator.rb
View file @
a457a86f
...
@@ -3,10 +3,10 @@ class JobDecorator < Draper::Decorator
...
@@ -3,10 +3,10 @@ class JobDecorator < Draper::Decorator
decorates_association
:city
decorates_association
:city
def
city_name
def
city_name
object
&
.
cities
&
.
first
&
.
name
object
.
cities
&
.
first
&
.
name
end
end
def
display_short_des
def
display_short_des
object
.
short_des
.
truncate
(
250
)
object
.
short_des
&
.
truncate
(
250
)
end
end
end
end
app/models/city.rb
View file @
a457a86f
...
@@ -25,6 +25,6 @@ class City < ApplicationRecord
...
@@ -25,6 +25,6 @@ class City < ApplicationRecord
end
end
def
self
.
city_order
def
self
.
city_order
@city_order
||=
all
.
sort_by
(
&
:job_count
).
reverse
@city_order
||=
all
.
sort_by
(
&
:job_count
).
reverse
.
take
(
Settings
.
top
.
city
.
limit
)
end
end
end
end
app/models/industry.rb
View file @
a457a86f
...
@@ -21,6 +21,6 @@ class Industry < ApplicationRecord
...
@@ -21,6 +21,6 @@ class Industry < ApplicationRecord
end
end
def
self
.
industry_order
def
self
.
industry_order
@industry_order
||=
all
.
sort_by
(
&
:job_count
).
reverse
@industry_order
||=
all
.
sort_by
(
&
:job_count
).
reverse
.
take
(
Settings
.
top
.
city
.
limit
)
end
end
end
end
app/views/jobs/show.html.erb
0 → 100644
View file @
a457a86f
config/routes.rb
View file @
a457a86f
...
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
...
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
resources
:companies
,
only: :index
resources
:companies
,
only: :index
resources
:industries
,
only: :index
resources
:industries
,
only: :index
resources
:cities
,
only: :index
resources
:cities
,
only: :index
resources
:jobs
,
only:
:index
resources
:jobs
,
only:
[
:index
,
:show
]
devise_for
:users
devise_for
:users
root
"tops#index"
root
"tops#index"
namespace
:users
do
namespace
:users
do
...
...
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