announcement-test/app/controllers/announcements_controller.rb

39 lines
827 B
Ruby
Raw Normal View History

2014-04-01 07:12:43 +00:00
class AnnouncementsController < ApplicationController
def index
announcements = Bulletin.all
announcements.collect do |a|
{
"title" => a.title,
"body" => a.body,
"link_to_show" => OrbitHelper.url_to_show(a.uid,a.title.parameterize),
"more" => "More"
}
end
end
def widget
announcements = Bulletin.all
announcements.collect do |a|
{
"title" => a.title,
"subtitle" => a.body,
"link_to_show" => OrbitHelper.url_to_show(a.uid,a.title.parameterize),
"more" => "More",
"link_to_index" => "index"
}
end
end
def show
params = OrbitHelper.get_params
announcement = Bulletin.find_by_param(params[:uid])
{
"title" => announcement.title,
"body" => announcement.body
}
end
end