46 lines
929 B
Ruby
46 lines
929 B
Ruby
class AnnouncementsController < ApplicationController
|
|
|
|
def index
|
|
announcements = Bulletin.filter_by_categories
|
|
anns = announcements.collect do |a|
|
|
{
|
|
"title" => a.title,
|
|
"body" => a.body,
|
|
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
|
"more" => "More",
|
|
}
|
|
end
|
|
{
|
|
"data" => anns
|
|
}
|
|
|
|
end
|
|
|
|
def widget
|
|
announcements = Bulletin.all
|
|
anns = announcements.collect do |a|
|
|
{
|
|
"title" => a.title,
|
|
"subtitle" => a.body,
|
|
"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_param(params[:uid])
|
|
{
|
|
"title" => announcement.title,
|
|
"body" => announcement.body
|
|
}
|
|
end
|
|
|
|
end
|