job form category and industry type forms added
This commit is contained in:
parent
e52310fab5
commit
713ac7f793
|
@ -1,4 +1,77 @@
|
|||
class Admin::RecruitmentsController < OrbitAdminController
|
||||
def index
|
||||
end
|
||||
|
||||
def industries
|
||||
@industries = RecruitmentIndustry.all
|
||||
end
|
||||
|
||||
def addindustry
|
||||
@industry = RecruitmentIndustry.new
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def createindustry
|
||||
industry = RecruitmentIndustry.create(industry_params)
|
||||
redirect_to industries_admin_recruitments_path
|
||||
end
|
||||
|
||||
def editindustry
|
||||
@industry = RecruitmentIndustry.find(params[:id])
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def updateindustry
|
||||
industry = RecruitmentIndustry.find(params[:id])
|
||||
industry.update_attributes(industry_params)
|
||||
redirect_to industries_admin_recruitments_path
|
||||
end
|
||||
|
||||
def deleteindustry
|
||||
industry = RecruitmentIndustry.find(params[:id])
|
||||
industry.destroy
|
||||
redirect_to industries_admin_recruitments_path
|
||||
end
|
||||
|
||||
|
||||
def categories
|
||||
@categories = RecruitmentCategory.all
|
||||
end
|
||||
|
||||
def addcategory
|
||||
@category = RecruitmentCategory.new
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def createcategory
|
||||
category = RecruitmentCategory.create(category_params)
|
||||
redirect_to categories_admin_recruitments_path
|
||||
end
|
||||
|
||||
def editcategory
|
||||
@category = RecruitmentCategory.find(params[:id])
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def updatecategory
|
||||
category = RecruitmentCategory.find(params[:id])
|
||||
category.update_attributes(category_params)
|
||||
redirect_to categories_admin_recruitments_path
|
||||
end
|
||||
|
||||
def deletecategory
|
||||
category = RecruitmentCategory.find(params[:id])
|
||||
category.destroy
|
||||
redirect_to categories_admin_recruitments_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def industry_params
|
||||
params.require(:recruitment_industry).permit!
|
||||
end
|
||||
|
||||
def category_params
|
||||
params.require(:recruitment_category).permit!
|
||||
end
|
||||
end
|
|
@ -104,7 +104,10 @@ class RecruitmentsController < PseudoSessionController
|
|||
end
|
||||
|
||||
def recruitment_job_params
|
||||
params.require(:recruitment_job).permit!
|
||||
par = params.require(:recruitment_job).permit!
|
||||
par[:skills] = par[:skills].split(",") if par[:skills].present?
|
||||
par[:skills].collect!{|sk| sk.strip}
|
||||
par
|
||||
end
|
||||
|
||||
end
|
|
@ -14,6 +14,7 @@ class EmployerProfile
|
|||
field :country_code
|
||||
field :phone_number
|
||||
field :mobile_number
|
||||
field :industry
|
||||
|
||||
mount_uploader :avatar, ImageUploader
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class RecruitmentCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :job_category, localize: true
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class RecruitmentIndustry
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :industry_title, localize: true
|
||||
end
|
|
@ -19,7 +19,7 @@ class RecruitmentJob
|
|||
field :work_experience_months, type: Integer
|
||||
field :academic_requirement
|
||||
field :language_requirement
|
||||
field :tools_requirement
|
||||
field :skills, type: Array, :default => []
|
||||
field :category
|
||||
field :location_of_work
|
||||
field :industrial_area
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<%= form_for @category, :url => {:action => "createcategory"}, html: {:class => "form-horizontal", :id => "category_form"} do |f| %>
|
||||
<form class="form-horizontal">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :job_category_translations do |fe| %>
|
||||
<div class="control-group">
|
||||
<%= fe.label locale, t("recruitment.job_category") + " (" + t("#{locale}") + ")", :class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= fe.text_field locale %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</form>
|
||||
<% end %>
|
|
@ -0,0 +1,14 @@
|
|||
<%= form_for @industry, :url => {:action => "createindustry"}, html: {:class => "form-horizontal", :id => "industry_form"} do |f| %>
|
||||
<form class="form-horizontal">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :industry_title_translations do |fe| %>
|
||||
<div class="control-group">
|
||||
<%= fe.label locale, t("recruitment.industry_title") + " (" + t("#{locale}") + ")", :class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= fe.text_field locale %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</form>
|
||||
<% end %>
|
|
@ -0,0 +1,61 @@
|
|||
<span id="index_table">
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th>Title</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @categories.each do |category| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= category.job_category_translations["en"] %> / <%= category.job_category_translations["zh_tw"] %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<li><a href="<%= editcategory_admin_recruitment_path(category) %>" class="categoryBtn"><%= t(:edit) %></a></li>
|
||||
<li><a href="<%= deletecategory_admin_recruitment_path(category) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="pull-right">
|
||||
<a href="<%= addcategory_admin_recruitments_path %>" id="addIndustryBtn" class="btn btn-primary categoryBtn">Add Category</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Job Category</h3>
|
||||
</div>
|
||||
<div class="modal-body"></div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button class="btn btn-primary" id="save-btn">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var modal = $("#myModal");
|
||||
$(".categoryBtn").on("click",function(){
|
||||
var url = $(this).attr("href");
|
||||
$.ajax({
|
||||
url : url,
|
||||
type : "get",
|
||||
dataType : "html"
|
||||
}).done(function(html){
|
||||
modal.find(".modal-body").html(html);
|
||||
modal.modal("show");
|
||||
})
|
||||
return false;
|
||||
})
|
||||
$("#save-btn").on("click",function(){
|
||||
$("#category_form").submit();
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<%= form_for @category, :url => updatecategory_admin_recruitment_path(@category), html: {:class => "form-horizontal", :id => "category_form"} do |f| %>
|
||||
<form class="form-horizontal">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :job_category_translations do |fe| %>
|
||||
<div class="control-group">
|
||||
<%= fe.label locale, t("recruitment.job_category") + " (" + t("#{locale}") + ")", :class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= fe.text_field locale, :value => @category.job_category_translations[locale.to_s] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</form>
|
||||
<% end %>
|
|
@ -0,0 +1,14 @@
|
|||
<%= form_for @industry, :url => updateindustry_admin_recruitment_path(@industry), html: {:class => "form-horizontal", :id => "industry_form"} do |f| %>
|
||||
<form class="form-horizontal">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :industry_title_translations do |fe| %>
|
||||
<div class="control-group">
|
||||
<%= fe.label locale, t("recruitment.industry_title") + " (" + t("#{locale}") + ")", :class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= fe.text_field locale, :value => @industry.industry_title_translations[locale.to_s] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</form>
|
||||
<% end %>
|
|
@ -0,0 +1,61 @@
|
|||
<span id="index_table">
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th>Title</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @industries.each do |industry| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= industry.industry_title_translations["en"] %> / <%= industry.industry_title_translations["zh_tw"] %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<li><a href="<%= editindustry_admin_recruitment_path(industry) %>" class="industryBtn"><%= t(:edit) %></a></li>
|
||||
<li><a href="<%= deleteindustry_admin_recruitment_path(industry) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="pull-right">
|
||||
<a href="<%= addindustry_admin_recruitments_path %>" id="addIndustryBtn" class="btn btn-primary industryBtn">Add Industry</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Industry</h3>
|
||||
</div>
|
||||
<div class="modal-body"></div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button class="btn btn-primary" id="save-btn">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var modal = $("#myModal");
|
||||
$(".industryBtn").on("click",function(){
|
||||
var url = $(this).attr("href");
|
||||
$.ajax({
|
||||
url : url,
|
||||
type : "get",
|
||||
dataType : "html"
|
||||
}).done(function(html){
|
||||
modal.find(".modal-body").html(html);
|
||||
modal.modal("show");
|
||||
})
|
||||
return false;
|
||||
})
|
||||
$("#save-btn").on("click",function(){
|
||||
$("#industry_form").submit();
|
||||
})
|
||||
</script>
|
|
@ -63,11 +63,19 @@
|
|||
</div>
|
||||
|
||||
<%= f.fields_for :employer_profile do |fe| %>
|
||||
<!-- Industry type -->
|
||||
<div class="form-group">
|
||||
<%= fe.label :industry, "Industry", :class => "col-sm-2 control-label" %>
|
||||
<div class="col-sm-5">
|
||||
<%= fe.select :industry, RecruitmentIndustry.all.collect{|ri| [ri.industry_title, ri.id.to_s]}, {:include_blank => "Select Industry"}, {:class => "form-control"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Country -->
|
||||
<div class="form-group">
|
||||
<%= fe.label :country, "Country", :class => "col-sm-2 control-label" %>
|
||||
<div class="col-sm-5">
|
||||
<%= fe.select :country, MiscList.countries_for_select, :class => "form-control" %>
|
||||
<%= fe.select :country, MiscList.countries_for_select, {:include_blank => "Select Country"}, {:class => "form-control"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -60,6 +60,14 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<hr>
|
||||
|
||||
<!-- Job Category -->
|
||||
<div class="form-group">
|
||||
<%= f.label :category, "Category", :class => "col-sm-2 control-label" %>
|
||||
<div class="col-sm-5">
|
||||
<%= f.select :category, RecruitmentCategory.all.collect{|rc| [rc.job_category,rc.id.to_s]}, {:include_blank => "Select Category"},{:class => "form-control"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- salary type -->
|
||||
<div class="form-group">
|
||||
|
@ -212,9 +220,9 @@
|
|||
|
||||
<!-- Tools Req -->
|
||||
<div class="form-group">
|
||||
<%= f.label :tools_requirement, "Tools Requirement", :class => "col-sm-2 control-label" %>
|
||||
<%= f.label :tools_requirement, "Skills", :class => "col-sm-2 control-label" %>
|
||||
<div class="col-sm-5">
|
||||
<%= f.text_field :tools_requirement, :class => "form-control", :placeholder => "Seperate with (,) ex; Word, Excel" %>
|
||||
<%= f.text_field :skills, :class => "form-control", :placeholder => "Seperate with (,) ex; Word, Excel", :value => @job.skills.join(", ") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -222,6 +230,7 @@
|
|||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<%= f.hidden_field :employer_profile_id, :value => @profile.profile.id %>
|
||||
<%= f.submit "Submit", :class =>"btn btn-primary" %>
|
||||
<a href="<%= mydashboard_path %>" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,4 +5,9 @@ en:
|
|||
recruitment: Recruitment
|
||||
select_a_profile: Please select a profile
|
||||
employee: Employee
|
||||
employer: Employer
|
||||
employer: Employer
|
||||
members: Members
|
||||
industries: Industry Type
|
||||
categories: Job Categories
|
||||
industry_title: Industry Title
|
||||
job_category: Job Category
|
|
@ -5,4 +5,9 @@ zh_tw:
|
|||
recruitment: Recruitment
|
||||
select_a_profile: Please select a profile
|
||||
employee: Employee
|
||||
employer: Employer
|
||||
employer: Employer
|
||||
members: Members
|
||||
industries: Industry Type
|
||||
categories: Job Categories
|
||||
industry_title: Industry Title
|
||||
job_category: Job Category
|
|
@ -4,6 +4,24 @@ Rails.application.routes.draw do
|
|||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
resources :recruitments do
|
||||
collection do
|
||||
get "industries"
|
||||
get "categories"
|
||||
get "addindustry"
|
||||
post "createindustry"
|
||||
|
||||
get "addcategory"
|
||||
post "createcategory"
|
||||
end
|
||||
member do
|
||||
delete "deleteindustry"
|
||||
get "editindustry"
|
||||
patch "updateindustry"
|
||||
|
||||
delete "deletecategory"
|
||||
get "editcategory"
|
||||
patch "updatecategory"
|
||||
end
|
||||
end
|
||||
end
|
||||
scope "recruit" do
|
||||
|
|
|
@ -9,7 +9,7 @@ module Recruitment
|
|||
set_keyword_contstraints ["/recruit/"]
|
||||
side_bar do
|
||||
head_label_i18n 'recruitment.recruitment', icon_class: "icons-briefcase"
|
||||
available_for "admin"
|
||||
available_for "managers"
|
||||
active_for_controllers (['admin/recruitments'])
|
||||
head_link_path "admin_recruitments_path"
|
||||
|
||||
|
@ -17,7 +17,18 @@ module Recruitment
|
|||
:link_path=>"admin_recruitments_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/recruitments'=>"index"},
|
||||
:available_for => 'admin'
|
||||
:available_for => 'managers'
|
||||
|
||||
context_link 'recruitment.industries',
|
||||
:link_path=>"industries_admin_recruitments_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/recruitments'=>"industries"},
|
||||
:available_for => 'managers'
|
||||
context_link 'recruitment.categories',
|
||||
:link_path=>"categories_admin_recruitments_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/recruitments'=>"categories"},
|
||||
:available_for => 'managers'
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue