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
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xuan Trung Le
venjob
Commits
f08ceac1
Commit
f08ceac1
authored
Nov 15, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs: jobs can apply when out of date
parent
8aedb1db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
app/controllers/applies_controller.rb
+9
-0
app/views/jobs/show.html.erb
+6
-5
No files found.
app/controllers/applies_controller.rb
View file @
f08ceac1
class
AppliesController
<
ApplicationController
class
AppliesController
<
ApplicationController
before_action
:admin_can_not_do_this
before_action
:admin_can_not_do_this
before_action
:authenticate_user!
before_action
:authenticate_user!
before_action
:check_deadline
def
apply
def
apply
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
if
session
[
:candidate
].
present?
if
session
[
:candidate
].
present?
...
@@ -45,4 +46,12 @@ class AppliesController < ApplicationController
...
@@ -45,4 +46,12 @@ class AppliesController < ApplicationController
def
application_params
def
application_params
params
.
require
(
:apply_job
).
permit
(
:name
,
:email
,
:cv
)
params
.
require
(
:apply_job
).
permit
(
:name
,
:email
,
:cv
)
end
end
def
check_deadline
job
=
Job
.
find
(
params
[
:job_id
])
if
Date
.
today
>
job
.
expiry_date
flash
[
:notice
]
=
"Job was expiried date"
redirect_back
(
fallback_location:
root_path
)
end
end
end
end
app/views/jobs/show.html.erb
View file @
f08ceac1
...
@@ -24,16 +24,17 @@
...
@@ -24,16 +24,17 @@
</div>
</div>
<%
end
%>
<%
end
%>
<div
class=
"col-md-9"
>
<div
class=
"col-md-9"
>
<h1>
2.
<%=
@job
.
name
%>
</h1>
<h1>
<%=
@job
.
name
%>
</h1>
<p>
3.
<%=
link_to
@job
.
company
.
name
,
company_jobs_path
(
@job
.
company
)
%>
</p>
<p>
<%=
link_to
@job
.
company
.
name
,
company_jobs_path
(
@job
.
company
)
%>
</p>
<p>
4.
Location:
<p>
Location:
<%-
@job
.
cities
.
each_with_index
do
|
city
,
index
|
-%>
<%-
@job
.
cities
.
each_with_index
do
|
city
,
index
|
-%>
<%=
"
#{
index
>
0
?
','
:
''
}
"
%>
<%=
"
#{
index
>
0
?
','
:
''
}
"
%>
<%=
link_to
city
.
name
,
city_jobs_path
(
city
)
%>
<%=
link_to
city
.
name
,
city_jobs_path
(
city
)
%>
<%-
end
-%>
<%-
end
-%>
</p>
</p>
<p>
5. Salary:
<%=
@job
.
salary
%>
</p>
<p>
Salary:
<%=
@job
.
salary
%>
</p>
<p>
6 Long Description:
<p>
Deadline to apply:
<%=
l
@job
.
expiry_date
,
format: :default
%>
</p>
<p>
Long Description:
<%=
@job
.
description
.
html_safe
%>
<%=
@job
.
description
.
html_safe
%>
</p>
</p>
</div>
</div>
...
...
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