From af6e7d5ac5821441f0c0f7739d974c4d6221fc43 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 6 Jun 2014 17:48:33 +0800 Subject: [PATCH] added statuses to widget and index --- app/controllers/announcements_controller.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 59918f0..eac3588 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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",