Update Announcement frontend

This commit is contained in:
manson 2014-05-01 17:28:20 +08:00
parent 9448c519df
commit 02cbd322d8
1 changed files with 10 additions and 9 deletions

View File

@ -1,14 +1,14 @@
class AnnouncementsController < ApplicationController
def index
announcements = Bulletin.order_by(:created_at=>'desc').filter_by_categories
anns = announcements.collect do |a|
{
"title" => a.title,
"body" => a.text,
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"more" => "More",
}
announcements = Bulletin.order_by(:created_at=>'desc').filter_by_categories
anns = announcements.collect do |a|
{
"title" => a.title,
"subtitle" => a.subtitle,
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"more" => "More",
}
end
{
"data" => anns
@ -21,7 +21,7 @@ class AnnouncementsController < ApplicationController
anns = announcements.collect do |a|
{
"title" => a.title,
"subtitle" => a.text,
"subtitle" => a.subtitle,
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"more" => "More",
}
@ -38,6 +38,7 @@ class AnnouncementsController < ApplicationController
announcement = Bulletin.find_by(:uid=>params[:uid])
{
"title" => announcement.title,
"image" => (announcement.image.blank? ? "" : announcement.image.url),
"body" => announcement.text
}
end