update backend index table for expired bulletins

This commit is contained in:
manson 2014-08-08 11:45:33 +08:00
parent 26c78f46cc
commit c65d1da3bf
3 changed files with 16 additions and 3 deletions

View File

@ -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;
}

View File

@ -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?

View File

@ -13,10 +13,16 @@
<tbody>
<% @bulletins.each do |b| %>
<tr>
<td><%= b.status_for_table %></td>
<td>
<%= b.status_for_table %>
</td>
<td><%= b.category.title %></td>
<td>
<% if b.expired? %>
<%= b.title %> <span class='label'><%= t(:expired) %></span>
<% else %>
<a href="<%=page_for_bulletin(b)%>" target="_blank"><%= b.title %></a>
<% end %>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="#" class="detail-row" onclick="$('#<%= "#{b.id.to_s}-detail" %>').slideToggle(300); return false;"><%= t(:detail) %></a></li>
@ -28,7 +34,7 @@
</div>
</td>
<td><%= format_value b.postdate %></td>
<td><%= format_value b.deadline %></td>
<td class="<%= b.expired? ? "expired" : "" %>"><%= format_value b.deadline %></td>
<td><%= b.update_user.user_name %></td>
</tr>
<tr class="footable-row-detail">