From 2921aa62d4b70f51e61ffe6854c0cf8b942d97bc Mon Sep 17 00:00:00 2001 From: JiangRu Date: Wed, 25 Feb 2015 10:58:51 +0800 Subject: [PATCH] if no data , hide title&table --- app/controllers/announcements_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index dda0cc7..2b9ce38 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -33,6 +33,12 @@ class AnnouncementsController < ApplicationController "view_count" => a.view_count } end + + #If no data , hide title&table + if announcements.count == 0 + display = "hide" + end + { "announcements" => anns, "extras" => { @@ -44,7 +50,8 @@ class AnnouncementsController < ApplicationController "subtitle-head" => t('announcement.table.sub_title'), "category-head" => t('announcement.table.category'), "link-head" => t('announcement.table.link'), - "file-head" => t('announcement.table.file') + "file-head" => t('announcement.table.file'), + "display" => display }, "total_pages" => announcements.total_pages }