From 4123610d328463ff6992cf6abbbb3610b318822c Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 11 Dec 2014 17:41:42 +0800 Subject: [PATCH] category fix --- app/controllers/announcements_controller.rb | 2 ++ app/views/admin/announcements/_index.html.erb | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index b757c6e..6b11ff2 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -95,6 +95,8 @@ class AnnouncementsController < ApplicationController return {} end + return {} if announcement.category.disable + tags = announcement.tags.map{|tag| { "tag" => tag.name , "url" => OrbitHelper.page_for_tag(tag) diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index cf1f405..635b12b 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_index.html.erb @@ -16,14 +16,28 @@ <%= b.status_for_table %> - <%= b.category.title %> + + <%= b.category.title rescue "" %> + <% if (b.category.disable rescue false) %> + <%= t(:disabled) %> + <% end %> + <% if b.expired? %> <%= b.title %> <%= t(:expired) %> <% elsif !b.approved? %> - <%= b.title %> <%= t(:pending) %> + <% if (b.category.disable rescue false)%> + <%= b.title %> + <% else %> + <%= b.title %> + <% end %> + <%= t(:pending) %> <% else %> - <%= b.title %> + <% if (b.category.disable rescue false) %> + <%= b.title %> + <% else %> + <%= b.title %> + <% end %> <% end %>