47 lines
1.1 KiB
Ruby
47 lines
1.1 KiB
Ruby
class AnnouncementsController < ApplicationController
|
|
|
|
def index
|
|
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
|
|
}
|
|
|
|
end
|
|
|
|
def widget
|
|
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
|
|
{
|
|
"extras" => {"link_to_index" => "index","name" => "Harry"},
|
|
"data" => anns
|
|
}
|
|
end
|
|
|
|
|
|
def show
|
|
params = OrbitHelper.params
|
|
announcement = Bulletin.find_by(:uid=>params[:uid])
|
|
{
|
|
"title" => announcement.title,
|
|
"image" => (announcement.image.blank? ? "" : announcement.image.url),
|
|
"body" => announcement.text
|
|
}
|
|
end
|
|
|
|
end
|