From 6ec3bd189240426090149691e21a699123ac763b Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 11 Dec 2014 17:48:10 +0800 Subject: [PATCH] category fix --- app/controllers/faqs_controller.rb | 2 ++ app/views/admin/faqs/_index.html.erb | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/faqs_controller.rb b/app/controllers/faqs_controller.rb index c0f4cc2..53797fe 100644 --- a/app/controllers/faqs_controller.rb +++ b/app/controllers/faqs_controller.rb @@ -27,6 +27,8 @@ class FaqsController < ApplicationController faq = Qa.can_display.find_by_param(params[:uid]) url_to_edit = OrbitHelper.user_can_edit?(faq) ? "/admin/faqs/#{faq.id.to_s}/edit" : "" + + return {} if (faq.category.disable rescue false) faqs_files = faq.qa_files.collect do |f| { diff --git a/app/views/admin/faqs/_index.html.erb b/app/views/admin/faqs/_index.html.erb index f343445..4c8dc9d 100644 --- a/app/views/admin/faqs/_index.html.erb +++ b/app/views/admin/faqs/_index.html.erb @@ -10,7 +10,12 @@ <% @qas.each do |qa| %> <%= qa.status_for_table %> - <%= qa.category.title %> + + <%= qa.category.title rescue "" %> + <% if (qa.category.disable rescue false) %> + <%= t(:disabled) %> + <% end %> + <%= qa.title %>