add param files & links for index and widget

This commit is contained in:
JiangRu 2015-01-16 16:44:23 +08:00
parent 7412c2f928
commit e88916bbfb
1 changed files with 8 additions and 0 deletions

View File

@ -14,8 +14,12 @@ class AnnouncementsController < ApplicationController
"status-class" => "status-#{status['classname']}"
}
end
files = a.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue []
links = a.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
author = User.find(a.create_user_id).member_profile.name rescue ""
{
"bulletin_links" => links,
"bulletin_files" => files,
"title" => a.title,
"subtitle" => a.subtitle,
"statuses" => statuses,
@ -56,8 +60,12 @@ class AnnouncementsController < ApplicationController
"status-class" => "status-#{status['classname']}"
}
end
files = a.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue []
links = a.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
author = User.find(a.create_user_id).member_profile.name rescue ""
{
"bulletin_links" => links,
"bulletin_files" => files,
"title" => a.title,
"subtitle" => a.subtitle,
"statuses" => statuses,