Commit 6031ca87 by Ngô Trung Hưng

fix bug

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