added date expiry

This commit is contained in:
Harry Bomrah 2018-06-23 23:24:02 +08:00
parent da64fd9307
commit 614103f6d2
5 changed files with 14 additions and 0 deletions

View File

@ -89,6 +89,7 @@ class RecruitmentsController < PseudoSessionController
rjobs = [] rjobs = []
total_pages = 0 total_pages = 0
end end
rjobs = rjobs.excluded_expired
rjobs.each do |rj| rjobs.each do |rj|
if rj.work_experience_years == 0 && rj.work_experience_months == 0 if rj.work_experience_years == 0 && rj.work_experience_months == 0
wey = t("recruitment.fresher") wey = t("recruitment.fresher")

View File

@ -9,6 +9,7 @@ class RecruitmentJob
field :job_description, localize: true field :job_description, localize: true
field :responsibility, localize: true field :responsibility, localize: true
field :other_conditions, localize: true field :other_conditions, localize: true
field :expiry_date, type: DateTime
field :salary #type1 => negotiable type2 => according to company rules field :salary #type1 => negotiable type2 => according to company rules
field :travel_assignment #type1 => Need to travel, type2 => occasionally, type3 => travelling not required field :travel_assignment #type1 => Need to travel, type2 => occasionally, type3 => travelling not required
field :working_time #type1 => Day Shift, type2 => Night Shift field :working_time #type1 => Day Shift, type2 => Night Shift
@ -49,6 +50,7 @@ class RecruitmentJob
scope :jobs, ->{where(:post_type => "type1")} scope :jobs, ->{where(:post_type => "type1")}
scope :internships, ->{where(:post_type => "type2")} scope :internships, ->{where(:post_type => "type2")}
scope :exchanges, ->{where(:post_type => "type3")} scope :exchanges, ->{where(:post_type => "type3")}
scope :excluded_expired, ->{where(:expiry_date.gte => Time.now)}
def get_category def get_category
RecruitmentCategory.find(self.category).job_category rescue "" RecruitmentCategory.find(self.category).job_category rescue ""

View File

@ -6,6 +6,8 @@
<%# content_for :page_specific_javascript do %> <%# content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%# end %> <%# end %>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %> <% @site_in_use_locales.each_with_index do |locale, i| %>
@ -71,6 +73,13 @@
</div> </div>
</div> </div>
<div class="form-group">
<%= f.label :expiry_date, t("recruitment.expiry_date"), :class => "col-sm-2 control-label" %>
<div class="col-sm-6">
<%= f.datetime_picker :expiry_date, :no_label => true, :new_record => @job.new_record? %>
</div>
</div>
<!-- salary type --> <!-- salary type -->
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"><%= t("recruitment.salary-title") %></label> <label class="col-sm-2 control-label"><%= t("recruitment.salary-title") %></label>

View File

@ -8,6 +8,7 @@ en:
recruitment: Recruitment recruitment: Recruitment
recruitment: recruitment:
apply: Apply apply: Apply
expiry_date: Expired On
already_applied: Already Applied already_applied: Already Applied
input_zero_freshers: Please input 0 for freshers. input_zero_freshers: Please input 0 for freshers.
please_select: Please Select please_select: Please Select

View File

@ -10,6 +10,7 @@ zh_tw:
recruitment: 招募 recruitment: 招募
recruitment: recruitment:
apply: Apply apply: Apply
expiry_date: Expired On
already_applied: 已申請 already_applied: 已申請
input_zero_freshers: 社會新鮮人請輸入 0. input_zero_freshers: 社會新鮮人請輸入 0.
please_select: 請選擇 please_select: 請選擇