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