added check for disabled user, employees can set resume status to be inactive and active
This commit is contained in:
parent
563e42fdeb
commit
f72fc5bd9f
|
|
@ -147,8 +147,15 @@ class RecruitmentsController < PseudoSessionController
|
||||||
if !OrbitHelper.current_user.nil?
|
if !OrbitHelper.current_user.nil?
|
||||||
available = OrbitHelper.current_user.is_admin?
|
available = OrbitHelper.current_user.is_admin?
|
||||||
end
|
end
|
||||||
|
if available || available == "true"
|
||||||
|
pu = PseudoUser.find(session[:current_pseudo_user_id])
|
||||||
|
enabled = RecruitProfile.where(:pseudo_member_id => pu.user_name).first.enabled
|
||||||
|
else
|
||||||
|
enabled = false
|
||||||
|
end
|
||||||
{
|
{
|
||||||
"session" => available,
|
"session" => available,
|
||||||
|
"enabled" => enabled,
|
||||||
"url" => "/" + I18n.locale.to_s + page.url,
|
"url" => "/" + I18n.locale.to_s + page.url,
|
||||||
"type" => OrbitHelper.params[:page_id]
|
"type" => OrbitHelper.params[:page_id]
|
||||||
}
|
}
|
||||||
|
|
@ -633,10 +640,20 @@ class RecruitmentsController < PseudoSessionController
|
||||||
|
|
||||||
def update_settings
|
def update_settings
|
||||||
pu = PseudoUser.where(:user_name => @profile.pseudo_member_id).first
|
pu = PseudoUser.where(:user_name => @profile.pseudo_member_id).first
|
||||||
if pu.update_password(params[:password],params[:password_confirmation])
|
if params[:password].present?
|
||||||
redirect_to mydashboard_path
|
if pu.update_password(params[:password],params[:password_confirmation])
|
||||||
|
profile = @profile.profile
|
||||||
|
profile.active = params[:active].present?
|
||||||
|
profile.save
|
||||||
|
redirect_to mydashboard_path
|
||||||
|
else
|
||||||
|
redirect_to account_settings_path(:err => "1")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
redirect_to account_settings_path(:err => "1")
|
profile = @profile.profile
|
||||||
|
profile.active = params[:active].present?
|
||||||
|
profile.save
|
||||||
|
redirect_to mydashboard_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,14 @@ class RecruitProfile
|
||||||
has_one :employer_profile, :autosave => true, :dependent => :destroy
|
has_one :employer_profile, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :employer_profile, :allow_destroy => true
|
accepts_nested_attributes_for :employer_profile, :allow_destroy => true
|
||||||
|
|
||||||
|
before_create :disable_employer
|
||||||
|
|
||||||
|
|
||||||
|
def disable_employer
|
||||||
|
if self.is_employer?
|
||||||
|
self.enabled = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def disable_user
|
def disable_user
|
||||||
pu = PseudoUser.where(:user_name => self.pseudo_member_id).first
|
pu = PseudoUser.where(:user_name => self.pseudo_member_id).first
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
<div class="alert alert-danger"><%= t("recruitment.pass_confirm_pass_do_not_match") %></div>
|
<div class="alert alert-danger"><%= t("recruitment.pass_confirm_pass_do_not_match") %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<form class="form-horizontal" action="/recruit/update_settings" method="post">
|
<form class="form-horizontal" action="/recruit/update_settings" method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 control-label"><%= t("recruitment.search_active") %></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="checkbox" name="active" value="true" <%= @profile.profile.active ? "checked" : "" %> />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password" class="col-sm-2 control-label"><%= t("pseudo_members.password") %></label>
|
<label for="password" class="col-sm-2 control-label"><%= t("pseudo_members.password") %></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<% thissession = action_data("check_session") %>
|
<% thissession = action_data("check_session") %>
|
||||||
<% if thissession["session"] == "true" || thissession["session"] == true %>
|
<% if thissession["session"] == "true" || thissession["session"] == true %>
|
||||||
<%= render_view %>
|
<% if thissession["enabled"] == true %>
|
||||||
|
<%= render_view %>
|
||||||
|
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<div class="modal fade" id="advancedSearch" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
<div class="modal fade" id="advancedSearch" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||||
|
|
@ -36,6 +37,12 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<% else %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
alert("Your account is disabled. Please wait for administrator to enable it.");
|
||||||
|
window.location.href = "<%= thissession["url"] %>";
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
<% elsif thissession["session"] == "false" %>
|
<% elsif thissession["session"] == "false" %>
|
||||||
<div><%= t("recruitment.login_to_view") %> <a href="<%= thissession["url"] %>"><%= t("recruitment.login") %></a></div>
|
<div><%= t("recruitment.login_to_view") %> <a href="<%= thissession["url"] %>"><%= t("recruitment.login") %></a></div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,7 @@ en:
|
||||||
gender_title: Gender
|
gender_title: Gender
|
||||||
martial_title: Marital Status
|
martial_title: Marital Status
|
||||||
currency_type: Currency Type
|
currency_type: Currency Type
|
||||||
|
search_active: Enable resume to be searched
|
||||||
martial:
|
martial:
|
||||||
type1: Un-Married
|
type1: Un-Married
|
||||||
type2: Married
|
type2: Married
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,7 @@ zh_tw:
|
||||||
gender_title: 性別
|
gender_title: 性別
|
||||||
martial_title: 婚姻狀況
|
martial_title: 婚姻狀況
|
||||||
currency_type: 貨幣類型
|
currency_type: 貨幣類型
|
||||||
|
search_active: Enable resume to be searched
|
||||||
martial:
|
martial:
|
||||||
type1: 未婚
|
type1: 未婚
|
||||||
type2: 已婚
|
type2: 已婚
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue