Commit 6031ca87 by Ngô Trung Hưng

fix bug

parent 871a399c
Pipeline #939 canceled with stages
in 0 seconds
......@@ -3,23 +3,17 @@
# Application controller
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# before_action :debug
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale
# def debug
# puts "ab"
# byebug
# puts "adcsdcds"
# end
def set_locale
user_signed_in? ? locale = current_user.language.to_sym : locale = params[:locale].to_s.strip.to_sym
locale = (user_signed_in? ? current_user.language : params[:locale].to_s.strip).to_sym
I18n.locale = I18n.available_locales.include?(locale) ? locale : I18n.default_locale
end
def default_url_options
{locale: I18n.locale}
{ locale: I18n.locale }
end
protected
......
......@@ -2,7 +2,7 @@
# Applied jobs controller
class ApplyJobController < ApplicationController
before_action :authenticate_user!, only: :apply
before_action :authenticate_user!
def index
@jobs = current_user.applied_jobs.page(params[:page])
......@@ -18,7 +18,7 @@ class ApplyJobController < ApplicationController
def confirm
@apply_job = current_user.applied_jobs.new(applied_job_params)
@apply_job.cv = current_user.cv if @apply_job.cv.blank?
session[:cv_full_path] = @apply_job.cv.path
session[:cache_name] = @apply_job.cv.cache_name
if @apply_job.invalid?
errors = []
@apply_job.errors.full_messages.each { |mess| errors << "#{mess}<br>" }
......@@ -30,7 +30,7 @@ class ApplyJobController < ApplicationController
def done
data_apply = current_user.applied_jobs.new(applied_job_params)
data_apply.cv = File.new(session[:cv_full_path])
data_apply.cv.retrieve_from_cache!(session[:cache_name])
if data_apply.save
AppliedMailer.applied_job_mail_to(current_user.applied_jobs.last).deliver_now
render :done
......@@ -38,7 +38,7 @@ class ApplyJobController < ApplicationController
flash[:error] = t('apply_job.error')
redirect_to apply_path(job_id: applied_job_params[:job_id])
end
session.delete(:cv_full_path)
session.delete(:cache_name)
end
private
......
......@@ -7,34 +7,25 @@
</div>
<hr>
</div>
<div class="col-lg-12">
<div class="breadcrumb_total_search_pagination_jobs">
<div class="pagination_jobs">
<div id="paginator">
<%= paginate @jobs %>
</div>
</div>
</div>
</div>
<% if @jobs.blank? %>
<div class="col-lg-12">
<div class="breadcrumb_total_search">
<span class="breadcrumb-item active">
No record
<%= t('apply_job.no_record') %>
</span>
</div>
</div>
<% else %>
<%= render partial: 'apply_job/block_info_job', collection: @jobs, as: :data %>
<% end %>
<div class="col-lg-12">
<div class="breadcrumb_total_search_pagination_jobs">
<div class="pagination_jobs">
<div id="paginator">
<%= paginate @jobs %>
<div class="col-lg-12">
<div class="breadcrumb_total_search_pagination_jobs">
<div class="pagination_jobs">
<div id="paginator">
<%= paginate @jobs %>
</div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
\ No newline at end of file
......@@ -123,6 +123,7 @@ en:
confirm: 'Please confirm your information'
applied: 'Applied'
title: 'List Applied Jobs'
no_record: "You haven't applied yet."
already_taken: 'We have received your resume, the employer will contact you as soon as possible.'
activerecord:
attributes:
......
......@@ -123,6 +123,7 @@ vi:
confirm: 'Vui lòng xác nhận lại thông tin của bạn'
applied: 'Đã ứng tuyển'
title: 'Danh sách công việc đã ứng tuyển'
no_record: 'Bạn chưa ứng tuyển công việc nào hết.'
already_taken: 'Chúng tôi đã tiếp nhận hồ của bạn, nhà tuyển dụng sẽ liên hệ đến bạn trong thời gian sớm nhất.'
activerecord:
attributes:
......
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