From 55c1edebb7136d5126b086571327c0c8fd4b89af Mon Sep 17 00:00:00 2001 From: nccu Date: Tue, 24 Feb 2015 14:12:16 +0800 Subject: [PATCH] fix --- app/controllers/announcements_controller.rb | 5 +- app/views/admin/announcements/_index.html.erb | 58 ++++++++++++++++++- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 2e93c85..a0dc270 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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" : "" diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index b35a86b..ef4238d 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_index.html.erb @@ -17,7 +17,7 @@ <%= b.status_for_table %> <%= b.category.title %> - + + + + <% if b.expired? %> + <% if b.rejected %> + <% if !b.title_translations["zh_tw"].blank? %> + <%= b.title_translations["zh_tw"] %><%= t(:expired)+','+t(:rejected) %> : <%= b.rejection_reason rescue "" %>
+ <% end %> + <% if !b.title_translations["en"].blank? %> + <%= b.title_translations["en"] %><%= t(:expired)+','+t(:rejected) %> : <%= b.rejection_reason rescue "" %> + <% end %> + <% else %> + <% if !b.title_translations["zh_tw"].blank? %> + <%= b.title_translations["zh_tw"] %> <%= t(:expired) %>
+ <% end %> + <% if !b.title_translations["en"].blank? %> + <%= b.title_translations["en"] %> <%= t(:expired) %> + <% end %> + <% end %> + <% elsif b.rejected %> + <% url = page_for_bulletin(b) %> + <% if !b.title_translations["zh_tw"].blank? %> + <%= b.title_translations["zh_tw"] %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %>
+ <% end %> + <% if !b.title_translations["en"].blank? %> + <%= b.title_translations["en"] %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %> + <% end %> + <% elsif !b.approved? %> + <% url = page_for_news_bulletin(b) %> + <% if !b.title_translations["zh_tw"].blank? %> + <%= b.title_translations["zh_tw"] %> <%= t(:pending) %>
+ <% end %> + <% if !b.title_translations["en"].blank? %> + <%= b.title_translations["en"] %> <%= t(:pending) %> + <% end %> + <% else %> + <% url = page_for_news_bulletin(b) %> + <% if !b.title_translations["zh_tw"].blank? %> + <%= b.title_translations["zh_tw"] %>
+ <% end %> + <% if !b.title_translations["en"].blank? %> + <%= b.title_translations["en"] %> + <% end %> + <% end %> +
+ +
<%= format_value b.postdate %> "><%= format_value b.deadline %>