diff --git a/app/controllers/admin/recruitments_controller.rb b/app/controllers/admin/recruitments_controller.rb index 6fda688..1a8216a 100644 --- a/app/controllers/admin/recruitments_controller.rb +++ b/app/controllers/admin/recruitments_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 84b86ee..d9c0419 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -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 \ No newline at end of file diff --git a/app/models/employer_profile.rb b/app/models/employer_profile.rb index d54b443..f346b61 100644 --- a/app/models/employer_profile.rb +++ b/app/models/employer_profile.rb @@ -14,6 +14,7 @@ class EmployerProfile field :country_code field :phone_number field :mobile_number + field :industry mount_uploader :avatar, ImageUploader diff --git a/app/models/recruitment_category.rb b/app/models/recruitment_category.rb new file mode 100644 index 0000000..ee90af5 --- /dev/null +++ b/app/models/recruitment_category.rb @@ -0,0 +1,6 @@ +class RecruitmentCategory + include Mongoid::Document + include Mongoid::Timestamps + + field :job_category, localize: true +end \ No newline at end of file diff --git a/app/models/recruitment_industry.rb b/app/models/recruitment_industry.rb new file mode 100644 index 0000000..e7cebf4 --- /dev/null +++ b/app/models/recruitment_industry.rb @@ -0,0 +1,6 @@ +class RecruitmentIndustry + include Mongoid::Document + include Mongoid::Timestamps + + field :industry_title, localize: true +end \ No newline at end of file diff --git a/app/models/recruitment_job.rb b/app/models/recruitment_job.rb index 52bdfdf..bd72ccc 100644 --- a/app/models/recruitment_job.rb +++ b/app/models/recruitment_job.rb @@ -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 diff --git a/app/views/admin/recruitments/addcategory.html.erb b/app/views/admin/recruitments/addcategory.html.erb new file mode 100644 index 0000000..cf2865c --- /dev/null +++ b/app/views/admin/recruitments/addcategory.html.erb @@ -0,0 +1,14 @@ +<%= form_for @category, :url => {:action => "createcategory"}, html: {:class => "form-horizontal", :id => "category_form"} do |f| %> +
+<% end %> \ No newline at end of file diff --git a/app/views/admin/recruitments/addindustry.html.erb b/app/views/admin/recruitments/addindustry.html.erb new file mode 100644 index 0000000..6c8bc8f --- /dev/null +++ b/app/views/admin/recruitments/addindustry.html.erb @@ -0,0 +1,14 @@ +<%= form_for @industry, :url => {:action => "createindustry"}, html: {:class => "form-horizontal", :id => "industry_form"} do |f| %> + +<% end %> \ No newline at end of file diff --git a/app/views/admin/recruitments/categories.html.erb b/app/views/admin/recruitments/categories.html.erb new file mode 100644 index 0000000..0e5e75d --- /dev/null +++ b/app/views/admin/recruitments/categories.html.erb @@ -0,0 +1,61 @@ + +Title | +
---|
+ <%= category.job_category_translations["en"] %> / <%= category.job_category_translations["zh_tw"] %>
+
+
+
+ |
+
Title | +
---|
+ <%= industry.industry_title_translations["en"] %> / <%= industry.industry_title_translations["zh_tw"] %>
+
+
+
+ |
+