From 1b68a2009c08d8a51cededf826bf88d812f3e10c Mon Sep 17 00:00:00 2001 From: rulingcom Date: Thu, 10 Sep 2026 16:36:36 +0800 Subject: [PATCH] Fix render :text and stale event_date placeholders --- app/controllers/admin/recruitment_controller.rb | 9 +++++++-- app/views/admin/recruitment/_form.html.erb | 4 ++++ config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + lib/recruitment_mod/engine.rb | 2 +- modules/recruitment_mod/_recruitment_widget16.html.erb | 4 ++-- modules/recruitment_mod/_recruitment_widget17.html.erb | 4 ++-- modules/recruitment_mod/recruitment_index18.html.erb | 2 +- modules/recruitment_mod/recruitment_index19.html.erb | 2 +- modules/recruitment_mod/show.html.erb | 4 ++-- modules/recruitment_mod/show2.html.erb | 2 +- 11 files changed, 23 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/recruitment_controller.rb b/app/controllers/admin/recruitment_controller.rb index 7e7d0ac..c0d4894 100644 --- a/app/controllers/admin/recruitment_controller.rb +++ b/app/controllers/admin/recruitment_controller.rb @@ -84,7 +84,7 @@ class Admin::RecruitmentController < OrbitAdminController uids = iframe_params['member_ids'].to_a.map{|m_id| MemberProfile.find(m_id).uid rescue nil}.select{|uid| !uid.nil?} url_params = iframe_params.except(:member_ids) url_params['uids'] = uids if uids != [] - render :text => '/xhr/panel/recruitment/widget/sync_data?'+url_params.to_param + render :plain => '/xhr/panel/recruitment/widget/sync_data?'+url_params.to_param end def settings @setting = @recruitment_setting @@ -488,7 +488,12 @@ class Admin::RecruitmentController < OrbitAdminController recruitment.is_preview = true recruitment.save - render :text=>page_for_recruitment(recruitment) + "?preview=true" + preview_url = page_for_recruitment(recruitment) + if preview_url == "/" + render :json => { "error" => true, "message" => t("recruitment.no_recruitment_page") } + else + render :plain=>preview_url + "?preview=true" + end end def destroy_preview diff --git a/app/views/admin/recruitment/_form.html.erb b/app/views/admin/recruitment/_form.html.erb index ce16397..2f935ca 100644 --- a/app/views/admin/recruitment/_form.html.erb +++ b/app/views/admin/recruitment/_form.html.erb @@ -759,6 +759,10 @@ processData: false, contentType: false }).done(function(data){ + if(typeof data === "object" && data.error){ + alert(data.message); + return; + } if(window.location.protocol === "https:"){ data = data.replace("http:","https:"); } diff --git a/config/locales/en.yml b/config/locales/en.yml index e17ea05..10e37ba 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,6 +4,7 @@ en: recruitment_mod: recruitment_mod: Recruitment recruitment: + no_recruitment_page: "No recruitment page has been set. Please set one first." carousel_image_types: default: Default carousel: Carousel diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 098a90f..a1af7ee 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -4,6 +4,7 @@ zh_tw: recruitment_mod: recruitment_mod: 徵才資訊 recruitment: + no_recruitment_page: "沒有任何徵才頁面,請先設定一個" carousel_image_types: default: 預設 carousel: 輪播 diff --git a/lib/recruitment_mod/engine.rb b/lib/recruitment_mod/engine.rb index 48b6677..e7ef395 100644 --- a/lib/recruitment_mod/engine.rb +++ b/lib/recruitment_mod/engine.rb @@ -130,7 +130,7 @@ module RecruitmentMod authorizable frontend_enabled feeds_url "/xhr/recruitment/feeds" - feeds_time_field (::RecruitmentHelper.is_postdate_sort_first ? ['postdate', 'event_date'] : ['event_date', 'postdate']) + feeds_time_field (::RecruitmentHelper.is_postdate_sort_first ? ['postdate', 'recruitment_date'] : ['recruitment_date', 'postdate']) data_count 1..30 begin show_options data diff --git a/modules/recruitment_mod/_recruitment_widget16.html.erb b/modules/recruitment_mod/_recruitment_widget16.html.erb index e70b548..cc2c7e7 100644 --- a/modules/recruitment_mod/_recruitment_widget16.html.erb +++ b/modules/recruitment_mod/_recruitment_widget16.html.erb @@ -2,7 +2,7 @@ - + @@ -25,4 +25,4 @@
<%= t("recruitment.more") %>
- \ No newline at end of file + diff --git a/modules/recruitment_mod/_recruitment_widget17.html.erb b/modules/recruitment_mod/_recruitment_widget17.html.erb index 73ffb18..c48351c 100644 --- a/modules/recruitment_mod/_recruitment_widget17.html.erb +++ b/modules/recruitment_mod/_recruitment_widget17.html.erb @@ -12,7 +12,7 @@ {{title-head}}{{title}} - + @@ -21,4 +21,4 @@
<%= t("recruitment.more") %>
- \ No newline at end of file + diff --git a/modules/recruitment_mod/recruitment_index18.html.erb b/modules/recruitment_mod/recruitment_index18.html.erb index e03c805..68b079e 100644 --- a/modules/recruitment_mod/recruitment_index18.html.erb +++ b/modules/recruitment_mod/recruitment_index18.html.erb @@ -3,7 +3,7 @@
{{event_date-head}}{{recruitment_date-head}} {{title-head}} {{subtitle-head}} {{notes-head}} {{event_date-head}}{{event-time-formated}}{{recruitment_date-head}}{{event-time-formated}} {{subtitle}} {{notes-head}}{{notes}}
- + diff --git a/modules/recruitment_mod/recruitment_index19.html.erb b/modules/recruitment_mod/recruitment_index19.html.erb index 88a0e52..5ee429e 100644 --- a/modules/recruitment_mod/recruitment_index19.html.erb +++ b/modules/recruitment_mod/recruitment_index19.html.erb @@ -4,7 +4,7 @@ - + diff --git a/modules/recruitment_mod/show.html.erb b/modules/recruitment_mod/show.html.erb index 2ab841f..4a1770f 100644 --- a/modules/recruitment_mod/show.html.erb +++ b/modules/recruitment_mod/show.html.erb @@ -4,7 +4,7 @@ -{{link_to_edit}} \ No newline at end of file +{{link_to_edit}} diff --git a/modules/recruitment_mod/show2.html.erb b/modules/recruitment_mod/show2.html.erb index 67d80b2..83499e8 100644 --- a/modules/recruitment_mod/show2.html.erb +++ b/modules/recruitment_mod/show2.html.erb @@ -10,7 +10,7 @@
  • - {{event_date-head}} + {{recruitment_date-head}} {{updated_at}}
  • {{event_date-head}}{{recruitment_date-head}} {{title-head}} {{notes-head}}
    {{category-head}}{{event_date-head}}{{recruitment_date-head}} {{title-head}} {{view-count-head}}