2014-04-01 07:12:43 +00:00
|
|
|
class AnnouncementsController < ApplicationController
|
|
|
|
|
|
|
|
def index
|
2014-05-02 10:21:51 +00:00
|
|
|
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_categories
|
2014-05-01 09:28:20 +00:00
|
|
|
anns = announcements.collect do |a|
|
|
|
|
{
|
|
|
|
"title" => a.title,
|
|
|
|
"subtitle" => a.subtitle,
|
|
|
|
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
|
|
|
"more" => "More",
|
|
|
|
}
|
2014-04-01 07:12:43 +00:00
|
|
|
end
|
2014-04-02 06:44:36 +00:00
|
|
|
{
|
|
|
|
"data" => anns
|
|
|
|
}
|
2014-04-01 07:12:43 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def widget
|
2014-05-02 10:21:51 +00:00
|
|
|
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_categories
|
2014-04-02 06:44:36 +00:00
|
|
|
anns = announcements.collect do |a|
|
2014-04-01 07:12:43 +00:00
|
|
|
{
|
|
|
|
"title" => a.title,
|
2014-05-01 09:28:20 +00:00
|
|
|
"subtitle" => a.subtitle,
|
2014-04-02 06:44:36 +00:00
|
|
|
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
2014-04-01 07:12:43 +00:00
|
|
|
"more" => "More",
|
|
|
|
}
|
|
|
|
end
|
2014-04-02 06:44:36 +00:00
|
|
|
{
|
|
|
|
"data" => anns
|
|
|
|
}
|
2014-04-01 07:12:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def show
|
2014-04-21 07:39:13 +00:00
|
|
|
params = OrbitHelper.params
|
2014-05-02 10:21:51 +00:00
|
|
|
announcement = Bulletin.can_display.find_by(:uid=>params[:uid])
|
|
|
|
{
|
|
|
|
"title" => announcement.title,
|
|
|
|
"image" => (announcement.image.blank? ? "" : announcement.image.url),
|
|
|
|
"body" => announcement.text
|
|
|
|
}
|
2014-04-02 06:44:36 +00:00
|
|
|
end
|
|
|
|
|
2014-04-01 07:12:43 +00:00
|
|
|
end
|