48 lines
1.2 KiB
Ruby
48 lines
1.2 KiB
Ruby
class WebResourcesController < ApplicationController
|
|
|
|
def index
|
|
links = WebLink.order_by(:created_at=>'desc').filter_by_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
|
|
{
|
|
"web_link" => web_link,
|
|
"extras" => {"widget-title"=>t(:web_resource)}
|
|
}
|
|
end
|
|
|
|
def widget
|
|
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
|
|
{
|
|
"web_link" => web_link,
|
|
"extras" => {"widget-title"=>t(:web_resource),"more_url" => OrbitHelper.widget_more_url}
|
|
}
|
|
end
|
|
|
|
end
|