diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index a3d513e..547f1cd 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -673,8 +673,9 @@ class AnnouncementsController < ApplicationController else announcement = Bulletin.can_display_and_sorted.where(:uid => uid).first end - @bulletin = announcement announcement = Bulletin.where(:uid => uid).first if announcement.nil? + @bulletin = announcement + url_to_edit = OrbitHelper.user_can_edit?(announcement) ? "/admin/announcements/#{announcement.id.to_s}/edit" : "" access_level = OrbitHelper.user_access_level? @@ -691,6 +692,18 @@ class AnnouncementsController < ApplicationController return {} if (announcement.category.disable rescue false) + if !announcement.deadline.nil? && announcement.deadline < Time.now + return { + "tags" => [], + "bulletin_files" => [], + "bulletin_links" => [], + "data" => { + "title" => announcement.title, + "body" => "#{I18n.t('announcement.expired')}
#{I18n.t('announcement.go_back')}".html_safe + } + } + end + tags = announcement.tags.map{|tag| { "tag" => tag.name , "url" => OrbitHelper.page_for_tag(tag) diff --git a/config/locales/en.yml b/config/locales/en.yml index 61623cb..731544e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,8 @@ en: feed: Feed import: Import announcement: + expired: This announcement has been expired. + go_back: Go back to the list of announcements. annc_dept: Department manually_sort: Manually Sort enable_manually_sort: Enable Manually Sort diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index f4e6bf5..8c89a4b 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -4,6 +4,8 @@ zh_tw: import: 匯入 get_all_anncs_without_subannc: "選擇相關公告" announcement: + expired: 此則公告已過期 + go_back: 回到公告列表 annc_dept: 公告單位 manually_sort: 手動排序 enable_manually_sort: 開啟手動排序