announcement-test/app/controllers/announcements_controller.rb

39 lines
827 B
Ruby

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