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
f80735ef
Commit
f80735ef
authored
Oct 23, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
b73f6ed7
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
42 additions
and
84 deletions
+42
-84
app/assets/javascripts/application.js
+1
-1
app/assets/stylesheets/application.scss
+5
-1
app/controllers/application_controller.rb
+1
-4
app/controllers/applies_controller.rb
+13
-20
app/mailers/apply_job_mailer.rb
+1
-1
app/views/applies/apply.html.erb
+1
-1
app/views/applies/confirm.html.erb
+2
-2
app/views/applies/done.html.erb
+1
-1
app/views/apply_job_mailer/successful_email.text.erb
+0
-31
app/views/jobs/show.html.erb
+2
-2
app/views/layouts/_flash.html.erb
+1
-1
app/workers/email_worker.rb
+0
-8
config/environments/development.rb
+7
-7
config/routes.rb
+7
-4
No files found.
app/assets/javascripts/application.js
View file @
f80735ef
...
...
@@ -16,5 +16,5 @@
//= require javascripts/bootstrap.min.js
$
(
document
).
ready
(
function
(){
$
(
'
#
message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
$
(
'
.
message'
).
delay
(
5000
).
fadeOut
(
'slow'
);
});
app/assets/stylesheets/application.scss
View file @
f80735ef
...
...
@@ -11,7 +11,6 @@
background-color
:
#f5f5f5
;
}
.border_rd0
{
border-radius
:
0px
!
important
;
}
...
...
@@ -79,3 +78,8 @@
max-height
:
89px
;
}
// end
// Message
.message
{
position
:
fixed
;
right
:
0
}
app/controllers/application_controller.rb
View file @
f80735ef
...
...
@@ -3,9 +3,6 @@ class ApplicationController < ActionController::Base
helper_method
:clear_session
def
clear_session
session
[
:candidate_name
]
=
nil
session
[
:candidate_email
]
=
nil
session
[
:candidate_cv
]
=
nil
session
[
:job_id
]
=
nil
session
[
:candidate
]
=
{}
end
end
app/controllers/applies_controller.rb
View file @
f80735ef
...
...
@@ -2,28 +2,22 @@ class AppliesController < ApplicationController
before_action
:authenticate_user!
def
apply
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
@application
=
ApplyJob
.
new
if
session
[
:candidate_name
]
&&
session
[
:candidate_email
]
@application
=
ApplyJob
.
new
(
name:
session
[
:candidate_name
],
email:
session
[
:candidate_email
],
cv:
session
[
:candidate_cv
])
elsif
current_user
if
session
[
:candidate
].
present?
@application
=
ApplyJob
.
new
(
session
[
:candidate
])
else
@application
=
ApplyJob
.
new
(
name:
current_user
.
name
,
email:
current_user
.
email
,
cv:
current_user
.
cv
)
else
# Nothing.
end
end
def
confirm
@application
=
ApplyJob
.
new
(
application_params
)
@application
.
user
_id
=
current_user
.
id
@application
.
user
=
current_user
@application
.
job_id
=
session
[
:job_id
]
session
[
:candidate
_name
]
=
application_params
[
:name
]
session
[
:candidate_email
]
=
application_params
[
:email
]
session
[
:candidate_cv
]
=
application_params
[
:cv
]
session
[
:candidate
]
=
{
name:
application_params
[
:name
],
email:
application_params
[
:email
],
cv:
application_params
[
:cv
]}
unless
@application
.
valid?
flash
[
:error
]
=
@application
.
errors
.
full_messages
.
to_sentence
...
...
@@ -33,20 +27,19 @@ class AppliesController < ApplicationController
end
def
done
@application
=
ApplyJob
.
new
(
user_id:
current_user
.
id
,
job_id:
session
[
:job_id
],
name:
session
[
:candidate_name
],
email:
session
[
:candidate_email
],
cv:
session
[
:candidate_cv
])
@application
=
ApplyJob
.
new
(
user:
current_user
,
job_id:
session
[
:job_id
])
@application
.
attributes
=
session
[
:candidate
]
if
@application
.
save
flash
[
:notice
]
=
'Congratulation! Job was successfully applied'
EmailWorker
.
perform_in
(
1
.
seconds
,
@application
.
id
)
ApplyJobMailer
.
successful_email
(
@application
).
deliver_later
clear_session
end
end
private
def
application_params
params
.
require
(
:apply_job
).
permit
(
:name
,
:email
,
:cv
)
if
params
[
:apply_job
]
params
.
require
(
:apply_job
).
permit
(
:name
,
:email
,
:cv
)
end
end
app/mailers/apply_job_mailer.rb
View file @
f80735ef
...
...
@@ -3,6 +3,6 @@ class ApplyJobMailer < ApplicationMailer
def
successful_email
(
application
)
@application
=
application
mail
(
to:
@application
.
email
,
:subject
=>
"Thank you for apply with VeNJOB"
)
mail
(
to:
@application
.
email
,
subject:
"Thank you for apply with VeNJOB"
)
end
end
app/views/applies/apply.html.erb
View file @
f80735ef
...
...
@@ -5,7 +5,7 @@
<p
class=
"text-info"
>
1. Apply form
</p>
</div>
<div
class=
"form-horizontal"
>
<%=
form_for
@application
,
url:
confirm_
path
,
method: :post
do
|
f
|
%>
<%=
form_for
@application
,
url:
confirm_
applies_path
do
|
f
|
%>
<div
class=
"form-group"
>
<%=
f
.
label
:Email
,
'Email:'
,
class:
"control-label col-md-2"
%>
<div
class=
"col-sm-10"
>
...
...
app/views/applies/confirm.html.erb
View file @
f80735ef
...
...
@@ -10,12 +10,12 @@
<p>
Cv:
<%=
@application
.
cv
%>
</p>
<div
class=
"col-md-10"
>
<%=
button_to
"Edit"
,
apply_path
(
job_id:
session
[
:job_id
]),
apply_
applies_
path
(
job_id:
session
[
:job_id
]),
class:
"btn btn-primary col-md-4"
,
method: :get
%>
<%=
button_to
"Done"
,
done_path
,
done_
applies_
path
,
class:
"btn btn-primary col-md-offset-1 col-md-4"
%>
</div>
</div>
...
...
app/views/applies/done.html.erb
View file @
f80735ef
...
...
@@ -2,7 +2,7 @@
<div
class=
"container"
>
Apply New > Apply Confirmation > Apply Finish
<p><h3
class=
"text-info"
>
Thank you for applying
</h3></p>
<p><h4
class=
"text-info"
>
<%=
link_to
"Back to TOP page"
,
"/"
%>
</h4></p>
<p><h4
class=
"text-info"
>
<%=
link_to
"Back to TOP page"
,
root_path
%>
</h4></p>
</div>
</div>
</div>
app/views/apply_job_mailer/successful_email.text.erb
deleted
100644 → 0
View file @
b73f6ed7
<p><h3>
Dear:
<%=
@application
.
name
%>
</h3></p>
<p>
Thank you for applied with VenJOB.
Your applied job's information is as follow:
</p>
<p>
<span>
Job title:
</span>
<span>
<%=
@application
.
job
.
name
%>
</span>
</p>
<p>
<span>
Location:
</span>
<span>
<%=
@application
.
job
.
company
.
location
%>
</span>
</p>
<p>
<span>
Company:
</span>
<span>
<%=
@application
.
job
.
company
.
name
%>
</span>
</p>
</br>
<p>
Your submitted information:
</p>
<p>
<span>
Full Name:
</span>
<span>
<%=
@application
.
name
%>
</span>
</p>
<p>
<span>
Email:
</span>
<span>
<%=
@application
.
email
%>
</span>
</p>
<p>
<span>
CV Link:
</span>
<span>
<%=
@application
.
cv
%>
</span>
</p>
<p>
Best,
</p>
app/views/jobs/show.html.erb
View file @
f80735ef
...
...
@@ -33,11 +33,11 @@
</p>
</div>
<div
class=
"col-md-3"
>
<%=
link_to
"Apply"
,
apply_
path
(
job_id:
@job
.
id
),
method: :get
,
class:
"btn btn-primary btn-lg"
%>
<%=
link_to
"Apply"
,
apply_
applies_path
(
job_id:
@job
.
id
)
,
class:
"btn btn-primary btn-lg"
%>
</div>
<div
class=
"action"
>
<div
class=
"col-md-6"
>
<%=
link_to
"Apply"
,
"#"
,
class:
"btn btn-default btn-lg"
%>
<%=
link_to
"Apply"
,
apply_applies_path
(
job_id:
@job
.
id
)
,
class:
"btn btn-default btn-lg"
%>
</div>
<div
class=
"col-md-6"
>
<%=
link_to
"Favorite"
,
"#"
,
class:
"btn btn-default btn-lg"
%>
...
...
app/views/layouts/_flash.html.erb
View file @
f80735ef
<%
flash
.
each
do
|
name
,
msg
|
%>
<div
class=
"alert alert-info alert-dismissable fade in
"
style=
"position: fixed; right: 0"
id=
"
message"
>
<div
class=
"alert alert-info alert-dismissable fade in
message"
>
<a
href=
"#"
class=
"close"
data-dismiss=
"alert"
aria-label=
"close"
>
×
</a>
<strong>
<%=
"
#{
name
}
!"
%>
</strong>
<%=
msg
%>
</div>
...
...
app/workers/email_worker.rb
deleted
100644 → 0
View file @
b73f6ed7
class
EmailWorker
include
Sidekiq
::
Worker
def
perform
(
application_id
)
application
=
ApplyJob
.
find
(
application_id
)
ApplyJobMailer
.
successful_email
(
application
).
deliver
end
end
config/environments/development.rb
View file @
f80735ef
...
...
@@ -52,12 +52,12 @@ Rails.application.configure do
# config.action_mailer.smtp_settings = { address: 'localhost',
# port: 1025 }
config
.
action_mailer
.
smtp_settings
=
{
address:
"smtp.gmail.com"
,
port:
587
,
domain:
"example.com"
,
authentication:
"plain"
,
enable_starttls_auto:
true
,
user_name:
ENV
[
"GMAIL_USER"
],
password:
ENV
[
"GMAIL_PASSWORD"
]
address:
"smtp.gmail.com"
,
port:
587
,
domain:
"example.com"
,
authentication:
"plain"
,
enable_starttls_auto:
true
,
user_name:
ENV
[
"GMAIL_USER"
],
password:
ENV
[
"GMAIL_PASSWORD"
]
}
end
config/routes.rb
View file @
f80735ef
...
...
@@ -12,8 +12,11 @@ Rails.application.routes.draw do
get
'company/:company_id'
=>
"jobs#company"
,
as: :company
end
end
get
'apply'
=>
"applies#apply"
post
'confirm'
=>
"applies#confirm"
post
'done'
=>
"applies#done"
mount
Sidekiq
::
Web
,
at:
'/sidekiq'
resources
:applies
do
collection
do
get
'apply'
post
'confirm'
post
'done'
end
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