From c65d1da3bfe0fd056c26d4c065e28ef7709a4c98 Mon Sep 17 00:00:00 2001 From: manson Date: Fri, 8 Aug 2014 11:45:33 +0800 Subject: [PATCH] update backend index table for expired bulletins --- app/assets/stylesheets/admin/announcements.css | 3 +++ app/models/bulletin.rb | 4 ++++ app/views/admin/announcements/_index.html.erb | 12 +++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/admin/announcements.css b/app/assets/stylesheets/admin/announcements.css index afad32d..2c22c38 100644 --- a/app/assets/stylesheets/admin/announcements.css +++ b/app/assets/stylesheets/admin/announcements.css @@ -2,3 +2,6 @@ Place all the styles related to the matching controller here. They will automatically be included in application.css. */ +.table .expired{ + color: #BE2E2E; +} \ No newline at end of file diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 72562bd..4267639 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -60,6 +60,10 @@ class Bulletin mail = Email.find(self.email_id) rescue nil end + def expired? + (self.deadline < Time.now) rescue false + end + def destroy_email mail = Email.find(self.email_id) rescue nil mail.destroy if !mail.nil? diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index dd45318..c433d3b 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_index.html.erb @@ -13,10 +13,16 @@ <% @bulletins.each do |b| %> - <%= b.status_for_table %> + + <%= b.status_for_table %> + <%= b.category.title %> - <%= b.title %> + <% if b.expired? %> + <%= b.title %> <%= t(:expired) %> + <% else %> + <%= b.title %> + <% end %>
<%= format_value b.postdate %> - <%= format_value b.deadline %> + "><%= format_value b.deadline %> <%= b.update_user.user_name %>