This commit is contained in:
nccu 2015-02-24 14:12:16 +08:00
parent 3a166408e6
commit 55c1edebb7
2 changed files with 60 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class AnnouncementsController < ApplicationController
# announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories.filter_by_tags(OrbitHelper.page_tags)
if OrbitHelper.page_categories.first == "all"
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
else
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.filter_by_categories.filter_by_tags.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count)
end
@ -161,7 +161,8 @@ class AnnouncementsController < ApplicationController
def show
params = OrbitHelper.params
announcement = Bulletin.where(:title.ne => "").find_by(:uid=>params[:uid]) rescue nil
# announcement = Bulletin.where(:title.ne => "").find_by(:uid=>params[:uid]) rescue nil
announcement = Bulletin.find_by(:uid=>params[:uid])
if !announcement.nil?
url_to_edit = OrbitHelper.user_can_edit?(announcement) ? "/admin/announcements/#{announcement.id.to_s}/edit" : ""

View File

@ -17,7 +17,7 @@
<%= b.status_for_table %>
</td>
<td><%= b.category.title %></td>
<td>
<!-- <td>
<% if b.expired? %>
<%= b.title %> <span class='label'><%= t(:expired) %></span>
<% elsif b.rejected %>
@ -39,6 +39,62 @@
<% end %>
</ul>
</div>
</td> -->
<td>
<% if b.expired? %>
<% if b.rejected %>
<% if !b.title_translations["zh_tw"].blank? %>
<%= b.title_translations["zh_tw"] %><span class='label'><%= t(:expired)+''+t(:rejected) %> : <%= b.rejection_reason rescue "" %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<%= b.title_translations["en"] %><span class='label'><%= t(:expired)+''+t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
<% end %>
<% else %>
<% if !b.title_translations["zh_tw"].blank? %>
<%= b.title_translations["zh_tw"] %> <span class='label'><%= t(:expired) %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<%= b.title_translations["en"] %> <span class='label'><%= t(:expired) %></span>
<% end %>
<% end %>
<% elsif b.rejected %>
<% url = page_for_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
<% end %>
<% elsif !b.approved? %>
<% url = page_for_news_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t(:pending) %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t(:pending) %></span>
<% end %>
<% else %>
<% url = page_for_news_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a>
<% end %>
<% 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>
<% if can_edit_or_delete?(b) %>
<li><a href="/admin/announcements/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/announcements/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% if !b.approved && user_can_approve? && !b.expired? %>
<li><a href="#" class="appoval_button" data-approve-link="<%= "/#{I18n.locale.to_s}/announcements/#{b.to_param}" %>" data-id="<%= b.id.to_s %>"><%= t("announcements.approve") %></a></li>
<% end %>
<% end %>
</ul>
</div>
</td>
<td><%= format_value b.postdate %></td>
<td class="<%= b.expired? ? "expired" : "" %>"><%= format_value b.deadline %></td>