Commit 37e1a7ba by Thanh Hung Pham

Send mail apply complete

parent abd34948
...@@ -10,19 +10,21 @@ class JobsController < ApplicationController ...@@ -10,19 +10,21 @@ class JobsController < ApplicationController
end end
def apply def apply
@job_id = params[:job_id]
end end
def confirm def confirm
@fullname = params['fullname'] @fullname = params[:fullname]
@email = params['email'] @email = params[:email]
@job_id = params[:job_id]
end end
def done def done
@email = params[:email] @email = params[:email]
@fullname = params[:fullname] @fullname = params[:fullname]
@cv_link = 'link to download' @cv_link = 'link to download'
ApplyMailer.apply_mail(@email, @fullname, @cv_link).deliver @job = Job.find(params[:job_id])
ApplyMailer.apply_mail(@email, @fullname, @cv_link, @job).deliver
end end
def show def show
......
class ApplyMailer < ApplicationMailer class ApplyMailer < ApplicationMailer
default from: 'hungpt@zigexn.vn' default from: 'hungpt@zigexn.vn'
def apply_mail(email, fullname, cv_link) def apply_mail(email, fullname, cv_link, job)
@email = email @email = email
@fullname = fullname @fullname = fullname
@cv_link = cv_link @cv_link = cv_link
@job = job
mail(to: email, subject: 'Thank you for apply with VeNJOB') mail(to: email, subject: 'Thank you for apply with VeNJOB')
end end
end end
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<body> <body>
<p> Dear <%= @fullname %></p> <p> Dear <%= @fullname %></p>
<p> Thank you for applied with VenJOB. Your applied job's information is as follow: </p> <p> Thank you for applied with VenJOB. Your applied job's information is as follow: </p>
<p> Job title: <Job title> </p> <p> Job title: <%= @job.name %> </p>
<p> Location: <Job location> </p> <p> Location: <%= @job.city.name unless @job.city.nil? %> </p>
<p> Company: <Company> </p> <p> Company: <%= @job.company.name unless @job.company.nil? %> </p>
<p> Your submitted information: </p> <p> Your submitted information: </p>
<p> Full Name: <%= @fullname %> </p> <p> Full Name: <%= @fullname %> </p>
<p> Email: <%= @email %></p> <p> Email: <%= @email %> </p>
<p> CV Link: <%= @cv_link %></p> <p> CV Link: <%= @cv_link %> </p>
<p> Best, </p> <p> Best, </p>
</body> </body>
......
Hello Dear <%= @fullname %>
Thank you for applied with VenJOB. Your applied job's information is as follow:
Job title: <%= @job.name %>
Location: <%= @job.city.name unless @job.city.nil? %>
Company: <%= @job.company.name unless @job.company.nil? %>
Your submitted information:
Full Name: <%= @fullname %>
Email: <%= @email %>
CV Link: <%= @cv_link %>
Best,
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<div class="form-group"> <div class="form-group">
<label>Full name</label><br /> <label>Full name</label><br />
<%= text_field_tag 'fullname', current_user.fullname, class: 'form-control' %> <%= text_field_tag 'fullname', current_user.fullname, class: 'form-control' %>
<%= hidden_field_tag 'job_id', @job_id %>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Email</label><br /> <label>Email</label><br />
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<div class="form-group"> <div class="form-group">
<label>Full name</label><br /> <label>Full name</label><br />
<%= text_field_tag 'fullname', @fullname, class: 'form-control', readonly: true %> <%= text_field_tag 'fullname', @fullname, class: 'form-control', readonly: true %>
<%= hidden_field_tag 'job_id', @job_id %>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Email</label><br /> <label>Email</label><br />
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<%- if user_signed_in? -%> <%- if user_signed_in? -%>
<%= link_to 'Apply', jobs_apply_path, class: 'btn btn-primary' %> <%= link_to 'Apply', jobs_apply_path(job_id: @job.id), class: 'btn btn-primary' %>
<%- else -%> <%- else -%>
<%= link_to 'Apply', new_user_session_path, class: 'btn btn-primary' %> <%= link_to 'Apply', new_user_session_path, class: 'btn btn-primary' %>
<%- end -%> <%- end -%>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<div class="row"> <div class="row">
<div class="col-md-offset-3 "> <div class="col-md-offset-3 ">
<%- if user_signed_in? -%> <%- if user_signed_in? -%>
<%= link_to 'Apply', jobs_apply_path, class: 'btn btn-primary' %> <%= link_to 'Apply', jobs_apply_path(job_id: @job.id), class: 'btn btn-primary' %>
<%- else -%> <%- else -%>
<%= link_to 'Apply', new_user_session_path, class: 'btn btn-primary' %> <%= link_to 'Apply', new_user_session_path, class: 'btn btn-primary' %>
<%- end -%> <%- end -%>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment