added statuses to widget

This commit is contained in:
Harry Bomrah 2014-06-06 17:45:39 +08:00
parent 4a50726150
commit 176d338ed2
1 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
class WebResourcesController < ApplicationController class WebResourcesController < ApplicationController
def index 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| web_link = links.collect do |link|
statuses = link.statuses.collect do |status| statuses = link.statuses.collect do |status|
{ {
@ -23,10 +23,18 @@ class WebResourcesController < ApplicationController
end end
def widget 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| web_link = links.collect do |link|
statuses = link.statuses.collect do |status|
{
"status" => status,
"status-class" => "status-#{status.downcase}"
}
end
{ {
"title" => link.title, "title" => link.title,
"context" => link.context,
"statuses" => statuses,
"link_to_show" => link.url "link_to_show" => link.url
} }
end end