Commit 027bd940 by Tô Ngọc Ánh

Fix: display wrong fullname, email user at confirm page

parent 34c4d0c6
Pipeline #968 failed with stages
in 0 seconds
......@@ -4,6 +4,7 @@ class AppliedJobsController < ApplicationController
def new
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)
end
......@@ -11,10 +12,10 @@ class AppliedJobsController < ApplicationController
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?
if @applied_job.invalid?
flash.now[:error] = @applied_job.errors.full_messages
render :new
end
return if @applied_job.valid?
flash.now[:error] = @applied_job.errors.full_messages
render :new
end
def finish
......
class UsersController < ApplicationController
before_action :authenticate_user!, only: :my_page
def show
@user = User.find_by(id: params[:id])
end
def my_page
end
def my_page; end
end
module ApplicationHelper
def is_current_user?(user)
def current_user?(user)
current_user == user
end
end
......@@ -2,6 +2,6 @@ class AppliedJobMailer < ApplicationMailer
def success_email
@applied_job = params[:applied_job]
mail(to: @applied_job.email, subject: "Thank you for apply with VenJOB", bcc: ENV['GMAIL_USERNAME'])
mail(to: @applied_job.email, subject: 'Thank you for apply with VenJOB', bcc: ENV['GMAIL_USERNAME'])
end
end
......@@ -20,7 +20,7 @@
<%= f.label :full_name, class: 'h5 font-weight-bold' %>
</div>
<div class="col-8">
<h5><%= @applied_job.user.full_name %></h5>
<h5><%= @applied_job.full_name %></h5>
<%= f.hidden_field :full_name %>
</div>
</div>
......@@ -29,7 +29,7 @@
<%= f.label :email, class: 'h5 font-weight-bold' %>
</div>
<div class="col-8">
<h5><%= @applied_job.user.email %></h5>
<h5><%= @applied_job.email %></h5>
<%= f.hidden_field :email %>
</div>
</div>
......
......@@ -21,7 +21,7 @@
You don't have any curriculum vitae
<% end %>
</p>
<% if is_current_user?(user) %>
<% if current_user?(user) %>
<div class="row">
<div class="col text-right">
<%= link_to 'Update', edit_user_registration_path, class: 'btn btn-outline-primary btn-lg' %>
......
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