added statuses to widget and index

This commit is contained in:
Harry Bomrah 2014-06-06 17:48:33 +08:00
parent b68a2c3b36
commit af6e7d5ac5
1 changed files with 14 additions and 0 deletions

View File

@ -3,9 +3,16 @@ class AnnouncementsController < ApplicationController
def index
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_categories
anns = announcements.collect do |a|
statuses = a.statuses.collect do |status|
{
"status" => status,
"status-class" => "status-#{status.downcase}"
}
end
{
"title" => a.title,
"subtitle" => a.subtitle,
"statuses" => statuses,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"),
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100",
@ -23,9 +30,16 @@ class AnnouncementsController < ApplicationController
def widget
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_widget_categories
anns = announcements.collect do |a|
statuses = a.statuses.collect do |status|
{
"status" => status,
"status-class" => "status-#{status.downcase}"
}
end
{
"title" => a.title,
"subtitle" => a.subtitle,
"statuses" => statuses,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"),
"link_to_show" => OrbitHelper.widget_item_url(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100",