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
Tô Ngọc Ánh
VeNJob
Commits
78fc0282
Commit
78fc0282
authored
Aug 17, 2020
by
Tô Ngọc Ánh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create finish page
parent
95aa91b3
Pipeline
#919
failed with stages
in 0 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
46 deletions
+97
-46
app/controllers/applied_jobs_controller.rb
+8
-5
app/mailers/application_mailer.rb
+1
-1
app/mailers/applied_job_mailer.rb
+7
-0
app/models/applied_job.rb
+1
-0
app/views/applied_job_mailer/success_email.html.erb
+22
-0
app/views/applied_jobs/_errors.html.erb
+6
-0
app/views/applied_jobs/confirm.html.erb
+46
-38
app/views/applied_jobs/new.html.erb
+2
-1
app/views/jobs/show.html.erb
+4
-1
No files found.
app/controllers/applied_jobs_controller.rb
View file @
78fc0282
...
...
@@ -5,20 +5,23 @@ class AppliedJobsController < ApplicationController
job
=
Job
.
find_by
(
id:
params
[
:job_id
])
return
redirect_to
root_path
if
job
.
nil?
@applied_job
=
job
.
applied_jobs
.
new
(
full_name:
current_user
.
full_name
,
email:
current_user
.
email
,
curriculum_vitae:
current_user
.
curriculum_vitae
)
email:
current_user
.
email
)
end
def
confirm
@applied_job
=
current_user
.
applied_jobs
.
new
(
applied_job_params
)
@applied_job
.
curriculum_vitae
=
current_user
.
curriculum_vitae
if
params
[
:applied_job
][
:curriculum_vitae
].
nil?
redirect_to
new_applied_job_path
(
job_id:
@applied_job
.
job_id
)
if
@applied_job
.
invalid?
if
@applied_job
.
invalid?
flash
[
:error
]
=
@applied_job
.
errors
.
full_messages
redirect_to
new_applied_job_path
(
job_id:
@applied_job
.
job_id
)
end
end
def
finish
@applied_job
=
current_user
.
applied_jobs
.
new
(
applied_job_params
)
@applied_job
.
valid?
@applied_job
.
errors
@applied_job
.
curriculum_vitae
=
File
.
new
(
params
[
:applied_job
][
:curriculum_vitae
])
@applied_job
.
save
AppliedJobMailer
.
with
(
applied_job:
@applied_job
).
success_email
.
deliver_later
end
private
...
...
app/mailers/application_mailer.rb
View file @
78fc0282
class
ApplicationMailer
<
ActionMailer
::
Base
default
from:
'
from@example
.com'
default
from:
'
admin@venjob
.com'
layout
'mailer'
end
app/mailers/applied_job_mailer.rb
0 → 100644
View file @
78fc0282
class
AppliedJobMailer
<
ApplicationMailer
def
success_email
@applied_job
=
params
[
:applied_job
]
mail
(
to:
@applied_job
.
email
,
subject:
"Your apply is successful!"
)
end
end
app/models/applied_job.rb
View file @
78fc0282
...
...
@@ -7,6 +7,7 @@ class AppliedJob < ApplicationRecord
validates
:full_name
,
presence:
true
,
length:
{
maximum:
200
}
validates
:email
,
presence:
true
,
format:
{
with:
EMAIL_REGEXN
}
validates
:curriculum_vitae
,
presence:
true
validates
:user
,
uniqueness:
{
scope: :job
,
message:
'already applied this job'
}
mount_uploader
:curriculum_vitae
,
CurriculumVitaeUploader
end
app/views/applied_job_mailer/success_email.html.erb
0 → 100644
View file @
78fc0282
<!DOCTYPE html>
<html>
<head>
<meta
content=
'text/html; charset=UTF-8'
http-equiv=
'Content-Type'
/>
</head>
<body>
<p>
Dear
<%=
@applied_job
.
full_name
%>
</p>
<br>
<p>
Thank you for applied with VenJOB. Your applied job's information is as follow:
</p>
<br>
<p>
Job title:
<%=
@applied_job
.
job
.
title
%>
</p>
<p>
Location:
<%=
@applied_job
.
job
.
locations
.
first
.
city
%>
</p>
<p>
Company:
<%=
@applied_job
.
job
.
company
.
name
%>
</p>
<br>
<p>
Your submitted information:
</p>
<p>
Full Name:
<%=
@applied_job
.
full_name
%>
</p>
<p>
Email:
<%=
@applied_job
.
email
%>
</p>
<p>
CV Link:
<%=
link_to
@applied_job
.
curriculum_vitae
.
identifier
,
root_url
+
@applied_job
.
curriculum_vitae
.
url
%>
</p>
<br>
<p>
Thanks and best regards.
</p>
</body>
</html>
app/views/applied_jobs/_errors.html.erb
0 → 100644
View file @
78fc0282
<div
class=
"alert alert-danger"
>
<a
href=
"#"
data-dismiss=
"alert"
class=
"close"
>
×
</a>
<%
flash
[
:error
]
&
.
each
do
|
error
|
%>
<p
class=
"mb-0"
>
<%=
error
%>
</p>
<%
end
%>
</div>
app/views/applied_jobs/confirm.html.erb
View file @
78fc0282
...
...
@@ -17,46 +17,54 @@
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-
6
col-sm-12 mx-auto"
>
<div
class=
"col-md-
7
col-sm-12 mx-auto"
>
<%=
form_for
@applied_job
,
url:
finish_applied_job_path
do
|
f
|
%>
<%=
f
.
hidden_field
:job_id
%>
<div
class=
"row"
>
<div
class=
"col-5"
>
<%=
f
.
label
:full_name
,
class:
'h5 font-weight-bold'
%>
</div>
<div
class=
"col-7"
>
<h5>
<%=
@applied_job
.
user
.
full_name
%>
</h5>
<%=
f
.
hidden_field
:full_name
%>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-5"
>
<%=
f
.
label
:email
,
class:
'h5 font-weight-bold'
%>
</div>
<div
class=
"col-7"
>
<h5>
<%=
@applied_job
.
user
.
email
%>
</h5>
<%=
f
.
hidden_field
:email
%>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-5"
>
<h5
class=
"font-weight-bold"
>
Curriculum Vitae
</h5>
</div>
<div
class=
"col-7"
>
<%=
link_to
@applied_job
.
curriculum_vitae
.
identifier
,
@applied_job
.
curriculum_vitae
.
url
,
download:
@applied_job
.
curriculum_vitae
.
identifier
%>
<%=
link_to
@applied_job
.
curriculum_vitae
.
url
,
target:
'_blank'
,
class:
'text-dark'
do
%>
<i
class=
"fas fa-eye"
></i>
<%
end
%>
<%=
f
.
hidden_field
:curriculum_vitae
,
class:
'd-none'
%>
</div>
</div>
<div
class=
"row my-3"
>
<div
class=
"col text-right"
>
<%=
link_to
'Edit'
,
new_applied_job_path
(
job_id:
@applied_job
.
job_id
),
class:
'btn btn-outline-secondary btn-lg'
%>
</div>
<div
class=
"col text-left"
>
<%=
f
.
submit
"Done"
,
class:
'btn btn-outline-success btn-lg'
%>
</div>
<div
class=
"row"
>
<div
class=
"col-4"
>
<%=
f
.
label
:job_name
,
class:
'h5 font-weight-bold'
%>
</div>
<div
class=
"col-8"
>
<h5>
<%=
@applied_job
.
job
.
title
%>
</h5>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-4"
>
<%=
f
.
label
:full_name
,
class:
'h5 font-weight-bold'
%>
</div>
<div
class=
"col-8"
>
<h5>
<%=
@applied_job
.
user
.
full_name
%>
</h5>
<%=
f
.
hidden_field
:full_name
%>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-4"
>
<%=
f
.
label
:email
,
class:
'h5 font-weight-bold'
%>
</div>
<div
class=
"col-8"
>
<h5>
<%=
@applied_job
.
user
.
email
%>
</h5>
<%=
f
.
hidden_field
:email
%>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-4"
>
<h5
class=
"font-weight-bold"
>
Curriculum Vitae
</h5>
</div>
<div
class=
"col-8"
>
<%=
link_to
@applied_job
.
curriculum_vitae
.
identifier
,
@applied_job
.
curriculum_vitae
.
url
,
download:
@applied_job
.
curriculum_vitae
.
identifier
%>
<%=
link_to
@applied_job
.
curriculum_vitae
.
url
,
target:
'_blank'
,
class:
'text-dark'
do
%>
<i
class=
"fas fa-eye"
></i>
<%
end
%>
<%=
f
.
hidden_field
:curriculum_vitae
,
class:
'd-none'
,
value:
@applied_job
.
curriculum_vitae
.
path
%>
</div>
</div>
<div
class=
"row my-3"
>
<div
class=
"col text-right"
>
<%=
link_to
'Edit'
,
new_applied_job_path
(
job_id:
@applied_job
.
job_id
),
class:
'btn btn-outline-secondary btn-lg'
%>
</div>
<div
class=
"col text-left"
>
<%=
f
.
submit
"Done"
,
class:
'btn btn-outline-success btn-lg'
%>
</div>
<%
end
%>
</div>
</div>
...
...
app/views/applied_jobs/new.html.erb
View file @
78fc0282
...
...
@@ -16,6 +16,7 @@
</h5>
</div>
</div>
<%=
render
'applied_jobs/errors'
if
flash
[
:error
].
present?
%>
<div
class=
"apply-form mx-5 px-5"
>
<%=
form_for
@applied_job
,
url:
confirm_applied_job_path
do
|
f
|
%>
<%=
f
.
hidden_field
:job_id
%>
...
...
@@ -31,7 +32,7 @@
<span
class=
"mt-2 font-weight-bold"
>
Curriculum Vitae
</span>
<div
class=
"w-75 mt-2"
>
<span
id=
"name_curriculum_vitae"
class=
"mr-2"
>
<%=
@applied_job
.
curriculum_vitae
.
identifier
%>
<%=
link_to
current_user
.
curriculum_vitae
.
identifier
,
current_user
.
curriculum_vitae
.
url
,
target:
'_blank'
%>
</span>
<%=
f
.
label
:curriculum_vitae
do
%>
<i
class=
"fas fa-file-upload fa-lg"
></i>
...
...
app/views/jobs/show.html.erb
View file @
78fc0282
...
...
@@ -31,7 +31,10 @@
<%=
@job
.
description
.
html_safe
%>
</div>
<div
class=
"col-2"
>
<%=
link_to
'Apply Now'
,
new_applied_job_path
(
job_id:
@job
.
id
),
class:
'btn btn-outline-success btn-lg'
%>
<%
is_not_applied
=
current_user
.
applied_jobs
.
find_by
(
job_id:
@job
.
id
).
blank?
%>
<%=
link_to_if
is_not_applied
,
'Apply Now'
,
new_applied_job_path
(
job_id:
@job
.
id
),
class:
'btn btn-outline-success btn-lg'
do
%>
<%=
link_to
'Apply Now'
,
'#'
,
class:
'btn btn-outline-secondary btn-lg disabled'
%>
<%
end
%>
</div>
</div>
<div
class=
"row my-3"
>
...
...
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