Commit 2d2646d2 by Hoang Nam Nguyen

'fixed apply_page'

parent 44f4d89b
class AppliesController < ApplicationController
before_action :redirect_to_root, unless: :logged_in?, only: :create
def new
@user_apply = Apply.new(session[:apply] || {})
end
def create
return if current_user.nil?
@user_apply = Apply.new(user_apply_job)
@user_apply.job_id = Job.find(params[:id]).id
@user_apply.user_id = @current_user.id
if @user_apply.valid?
session[:apply] = @user_apply.as_json
session[:apply] = @user_apply
redirect_to confirm_apply_path
else
render 'new'
......@@ -30,8 +30,12 @@ class AppliesController < ApplicationController
private
def user_apply_job
params.require(:apply).permit(:email, :name)
end
def redirect_to_root
redirect_to root_path
end
def user_apply_job
params.require(:apply).permit(:email, :name)
end
end
......@@ -3,7 +3,7 @@
<div class="search_list titlejob col-md-10">
<%= link_to apply.job.job_title,job_detail_path(apply.job.id),class: 'search_list_jobs_title' %>
<% unless apply.job.short_description.nil? %>
<% if apply.job.short_description.present? %>
<li class="detail_description">
<%= truncate apply.job.short_description,length: 250 %>
<%= link_to 'read more',job_detail_path(apply.job.id)%></li>
......@@ -14,7 +14,7 @@
<li class="detail_description col-md-5">
<%= apply.job.cities.map(&:location).join(',') %>
</li>
<% unless apply.job.salary.nil? %>
<% if apply.job.salary.present? %>
<li class=" detail_description float-right text-success col-md-5">
<%= apply.job.salary%>
</li>
......
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