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
104f2814
Commit
104f2814
authored
Dec 25, 2019
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check if job had been applied
parent
9949413a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
6 deletions
+99
-6
app/controllers/jobs_controller.rb
+18
-0
app/views/jobs/apply.html.erb
+33
-0
app/views/jobs/confirm_apply.html.erb
+32
-0
app/views/jobs/finish_apply.html.erb
+10
-0
app/views/jobs/show.html.erb
+4
-0
app/views/users/registrations/new.html.erb
+0
-6
config/routes.rb
+2
-0
No files found.
app/controllers/jobs_controller.rb
View file @
104f2814
...
...
@@ -22,4 +22,22 @@ class JobsController < ApplicationController
redirect_to
jobs_path
if
params
[
:job_id
].
blank?
@job_id
=
params
[
:job_id
]
end
def
confirm_apply
end
def
finish_apply
@apply_first_name
=
params
[
"confirm_apply_info"
][
"first_name"
]
@apply_last_name
=
params
[
"confirm_apply_info"
][
"last_name"
]
@apply_email
=
params
[
"confirm_apply_info"
][
"email"
]
@job_id
=
params
[
"confirm_apply_info"
][
"job_id"
]
if
params
[
:commit
]
==
"Edit"
render
"jobs/apply"
else
UserJob
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job_id
)
||
UserJob
.
create!
(
user_id:
current_user
.
id
,
job_id:
@job_id
,
applied_at:
Time
.
current
)
end
end
end
app/views/jobs/apply.html.erb
View file @
104f2814
...
...
@@ -5,3 +5,36 @@
<li
class=
"breadcrumb-item"
>
Finish
</li>
</ol>
</nav>
<h3>
Apply form
</h3>
<%=
form_for
"apply_info"
,
url:
confirm_path
,
method: :get
do
|
f
|
%>
<%=
f
.
hidden_field
:job_id
,
value:
@job_id
%>
<div
class=
"form-group"
>
<%=
f
.
label
:first_name
%>
<%=
f
.
text_field
:first_name
,
value:
(
@apply_first_name
||
@current_user
.
first_name
),
class:
"form-control"
,
required:
"true"
%>
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:last_name
%>
<%=
f
.
text_field
:last_name
,
value:
(
@apply_last_name
||
@current_user
.
last_name
),
class:
"form-control"
,
required:
"true"
%>
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:email
%>
<%=
f
.
email_field
:email
,
value:
(
@apply_email
||
@current_user
.
email
),
class:
"form-control"
,
required:
"true"
%>
</div>
<div
class=
"field"
>
<%=
f
.
label
:cv_path
%>
<input
type=
"file"
class=
"form-control-file"
id=
"cv_path"
>
</div>
<div
class=
"actions text-center"
>
<%=
f
.
submit
"Confirm"
,
class:
"btn btn-lg btn-primary"
%>
</div>
<%
end
%>
app/views/jobs/confirm_apply.html.erb
0 → 100644
View file @
104f2814
<nav
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
>
New
</li>
<li
class=
"breadcrumb-item active"
aria-current=
"page"
>
Confirmation
</li>
<li
class=
"breadcrumb-item"
>
Finish
</li>
</ol>
</nav>
<h3>
Confirmation
</h3>
<%=
form_for
"confirm_apply_info"
,
url:
done_path
,
method: :post
do
|
f
|
%>
<%=
f
.
hidden_field
:job_id
,
value:
params
[
"apply_info"
][
"job_id"
]
%>
<%=
f
.
hidden_field
:first_name
,
value:
params
[
"apply_info"
][
"first_name"
]
%>
<%=
f
.
hidden_field
:last_name
,
value:
params
[
"apply_info"
][
"last_name"
]
%>
<%=
f
.
hidden_field
:email
,
value:
params
[
"apply_info"
][
"email"
]
%>
<div
class=
"form-group"
>
<%=
f
.
label
:first_name
,
params
[
"apply_info"
][
"first_name"
]
%>
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:last_name
,
params
[
"apply_info"
][
"last_name"
]
%>
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:email
,
params
[
"apply_info"
][
"email"
]
%>
</div>
<div
class=
"actions text-center"
>
<%=
f
.
submit
"Edit"
,
class:
"btn btn-lg btn-primary"
%>
<%=
f
.
submit
"Done"
,
class:
"btn btn-lg btn-primary"
%>
</div>
<%
end
%>
app/views/jobs/finish_apply.html.erb
0 → 100644
View file @
104f2814
<nav
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
>
New
</li>
<li
class=
"breadcrumb-item"
>
Confirmation
</li>
<li
class=
"breadcrumb-item active"
aria-current=
"page"
>
Finish
</li>
</ol>
</nav>
<h2>
Thank you for apply
</h2>
<%=
link_to
"Back to the TOP page"
,
root_path
%>
app/views/jobs/show.html.erb
View file @
104f2814
...
...
@@ -32,5 +32,9 @@
<div
class=
"job_detail_button"
>
<%=
link_to
"Favorite"
,
"#"
,
class:
"btn btn-primary float-right"
%>
<%
if
UserJob
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job
.
id
)
%>
<button
type=
"button"
class=
"btn btn-primary float-right mx-3"
disabled
>
Apply
</button>
<%
else
%>
<%=
link_to
"Apply"
,
apply_path
(
job_id:
@job
.
id
),
class:
"btn btn-primary float-right mx-3"
%>
<%
end
%>
</div>
app/views/users/registrations/new.html.erb
View file @
104f2814
...
...
@@ -9,12 +9,6 @@
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:username
%>
<em>
(optional)
</em><br/>
<%=
f
.
text_field
:username
,
class:
"form-control"
%>
</div>
<div
class=
"form-group"
>
<%=
f
.
label
:password
%>
<%
if
@minimum_password_length
%>
<em>
(
<%=
@minimum_password_length
%>
characters minimum)
</em>
...
...
config/routes.rb
View file @
104f2814
...
...
@@ -6,6 +6,8 @@ Rails.application.routes.draw do
get
"jobs/city/:city_id"
,
to:
"jobs#index"
,
as: :city_jobs
get
"jobs/industry/:industry_id"
,
to:
"jobs#index"
,
as: :industry_jobs
get
"apply"
,
to:
"jobs#apply"
get
"confirm"
,
to:
"jobs#confirm_apply"
post
"done"
,
to:
'jobs#finish_apply'
devise_for
:users
root
"tops#index"
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