if no data , hide title&table

This commit is contained in:
JiangRu 2015-02-25 10:58:51 +08:00
parent 05eb32cbd2
commit 2921aa62d4
1 changed files with 8 additions and 1 deletions

View File

@ -33,6 +33,12 @@ class AnnouncementsController < ApplicationController
"view_count" => a.view_count "view_count" => a.view_count
} }
end end
#If no data , hide title&table
if announcements.count == 0
display = "hide"
end
{ {
"announcements" => anns, "announcements" => anns,
"extras" => { "extras" => {
@ -44,7 +50,8 @@ class AnnouncementsController < ApplicationController
"subtitle-head" => t('announcement.table.sub_title'), "subtitle-head" => t('announcement.table.sub_title'),
"category-head" => t('announcement.table.category'), "category-head" => t('announcement.table.category'),
"link-head" => t('announcement.table.link'), "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 "total_pages" => announcements.total_pages
} }