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
1
Merge Requests
1
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 Sỹ Hoàng
VenJob
Commits
ce6c91d9
Commit
ce6c91d9
authored
Jan 07, 2020
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
City_Jobs/Indutry_Jobs
parent
458e5189
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
22 deletions
+28
-22
app/assets/stylesheets/custom.scss
+1
-8
app/controllers/jobs_controller.rb
+10
-1
app/models/job.rb
+1
-0
app/views/cities/_city.html.erb
+1
-2
app/views/industries/_industry.html.erb
+1
-2
app/views/jobs/_jobs_list.html.erb
+7
-5
app/views/jobs/index.html.erb
+3
-3
config/routes.rb
+4
-1
No files found.
app/assets/stylesheets/custom.scss
View file @
ce6c91d9
/* universal */
/* universal */
$font-stack
:
Arial
,
Helvetica
,
sans-serif
;
$font-stack
:
Arial
,
Helvetica
,
sans-serif
;
$primary-color
:
rgb
(
164
,
165
,
167
)
;
$primary-color
:
#B6B6B6
;
$sub-color
:
gainsboro
;
$sub-color
:
gainsboro
;
body
{
body
{
...
@@ -110,10 +110,3 @@ h1, h2, h3, h4, h5, h6 {
...
@@ -110,10 +110,3 @@ h1, h2, h3, h4, h5, h6 {
margin-left
:
70px
;
margin-left
:
70px
;
top
:
300px
;
top
:
300px
;
}
}
.jobs-list
{
color
:
rgb
(
4
,
4
,
14
);
background-color
:
rgb
(
23
,
23
,
175
);
display
:block
;
}
app/controllers/jobs_controller.rb
View file @
ce6c91d9
class
JobsController
<
ApplicationController
class
JobsController
<
ApplicationController
def
index
def
index
@jobs
=
Job
.
all
.
page
(
params
[
:page
]).
per
(
Settings
.
all
.
job
.
limit
)
if
params
[
:city_id
].
present?
@jobs
=
City
.
find_by
(
id:
params
[
:city_id
]).
jobs
elsif
params
[
:industry_id
].
present?
@jobs
=
Industry
.
find_by
(
id:
params
[
:industry_id
]).
jobs
else
@jobs
=
Job
.
all
end
@jobs
=
@jobs
.
page
(
params
[
:page
]).
per
(
Settings
.
all
.
job
.
limit
)
end
end
end
end
app/models/job.rb
View file @
ce6c91d9
class
Job
<
ApplicationRecord
class
Job
<
ApplicationRecord
has_many
:user_jobs
has_many
:user_jobs
has_many
:city_jobs
has_many
:city_jobs
belongs_to
:city
def
self
.
latest_jobs
def
self
.
latest_jobs
@latest
||=
order
(
created_at: :desc
).
take
(
Settings
.
top
.
job
.
limit
)
@latest
||=
order
(
created_at: :desc
).
take
(
Settings
.
top
.
job
.
limit
)
...
...
app/views/cities/_city.html.erb
View file @
ce6c91d9
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col text-center"
>
<div
class=
"col text-center"
>
<%=
city
.
name
%>
<%=
link_to
"
#{
city
.
name
}
(
#{
city
.
jobs_count
}
)"
,
city_jobs_path
(
city
)
%>
(
<%=
city
.
jobs_count
%>
jobs)
</div>
</div>
</div>
</div>
</div>
</div>
app/views/industries/_industry.html.erb
View file @
ce6c91d9
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col text-center"
>
<div
class=
"col text-center"
>
<%=
industry
.
name
%>
<%=
link_to
"
#{
industry
.
name
}
(
#{
industry
.
jobs_count
}
)"
,
industry_jobs_path
(
industry
)
%>
(
<%=
industry
.
jobs_count
%>
jobs)
</div>
</div>
</div>
</div>
</div>
</div>
app/views/jobs/_jobs_list.html.erb
View file @
ce6c91d9
<div
class=
"jobs-list"
>
<div
class=
"jobs-list"
>
<div
class=
"row row-cols"
>
<div
class=
"row row-cols"
>
<div
class=
"col"
>
<div
class=
"col"
>
Title:
<%=
jobs_list
.
title
%>
<h4><b>
Title:
</b></h4>
<%=
simple_format
jobs_list
.
title
%>
</div>
</div>
<div
class=
"col"
>
<div
class=
"col"
>
Salary:
<%=
jobs_list
.
salary
%>
<h4><b>
Salary:
</b></h4>
<%=
jobs_list
.
salary
%>
</div>
</div>
<div
class=
"col"
>
<div
class=
"col"
>
<
%=
jobs_list
.
position
%>
<
h4><b>
Level:
</b></h4>
<%=
simple_format
jobs_list
.
position
%>
</div>
</div>
</div>
</div>
<div
class=
"row row-cols"
>
<div
class=
"row row-cols"
>
<div
class=
"col"
>
<div
class=
"col"
>
Description:
<%=
jobs_list
.
description
%>
<h4><b>
Description:
</b></h4>
<%=
truncate
(
jobs_list
.
description
,
length:
250
)
%>
</div>
</div>
</div>
</div>
<div
class=
"row row-cols"
>
<div
class=
"row row-cols"
>
<div
class=
"col"
>
<div
class=
"col"
>
Requirement:
<%=
jobs_list
.
requirement
%>
<h4>
<b>
Requirement:
</b></h4>
<%=
(
simple_format
jobs_list
.
requirement
)
%>
</div>
</div>
</div>
</div>
</br>
</br>
...
...
app/views/jobs/index.html.erb
View file @
ce6c91d9
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
<div
class=
"job-title-wrapper"
>
<div
class=
"job-title-wrapper"
>
<h3>
All Jobs
</h3>
<h3>
All Jobs
</h3>
</div>
</div>
<%=
paginate
@
all_
jobs
%>
<%=
paginate
@jobs
%>
<div
class=
"row row-cols-1"
>
<div
class=
"row row-cols-1"
>
<div
class=
"job-content-wrapper"
>
<div
class=
"job-content-wrapper"
>
<%=
render
partial:
"jobs/jobs_list"
,
collection:
@
all_
jobs
%>
<%=
render
partial:
"jobs/jobs_list"
,
collection:
@jobs
%>
</div>
</div>
</div>
</div>
<%=
paginate
@
all_
jobs
%>
<%=
paginate
@jobs
%>
config/routes.rb
View file @
ce6c91d9
...
@@ -18,9 +18,12 @@ Rails.application.routes.draw do
...
@@ -18,9 +18,12 @@ Rails.application.routes.draw do
put
"reset_password.user"
,
to:
"devise/passwords#update"
put
"reset_password.user"
,
to:
"devise/passwords#update"
end
end
get
"jobs/city/:city_id"
,
to:
"jobs#index"
,
as:
"city_jobs"
get
"jobs/industry/:industry_id"
,
to:
"jobs#index"
,
as:
"industry_jobs"
concern
:paginatable
do
concern
:paginatable
do
get
"(page/:page)"
,
action: :index
,
on: :collection
,
as:
""
get
"(page/:page)"
,
action: :index
,
on: :collection
,
as:
""
end
end
resources
:jobs
,
concerns: :paginatable
resources
:jobs
,
only: :index
,
concerns: :paginatable
end
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