From 176d338ed205ec88724eb1f2cca12760a96d8643 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 6 Jun 2014 17:45:39 +0800 Subject: [PATCH] added statuses to widget --- app/controllers/web_resources_controller.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/web_resources_controller.rb b/app/controllers/web_resources_controller.rb index 382e9bc..e5e8e8b 100644 --- a/app/controllers/web_resources_controller.rb +++ b/app/controllers/web_resources_controller.rb @@ -1,7 +1,7 @@ class WebResourcesController < ApplicationController def index - links = WebLink.order_by(:created_at=>'desc') + links = WebLink.order_by(:created_at=>'desc').filter_by_categories web_link = links.collect do |link| statuses = link.statuses.collect do |status| { @@ -23,10 +23,18 @@ class WebResourcesController < ApplicationController end def widget - links = WebLink.order_by(:created_at=>'desc') + links = WebLink.order_by(:created_at=>'desc').filter_by_widget_categories web_link = links.collect do |link| + statuses = link.statuses.collect do |status| + { + "status" => status, + "status-class" => "status-#{status.downcase}" + } + end { "title" => link.title, + "context" => link.context, + "statuses" => statuses, "link_to_show" => link.url } end