From e88916bbfb72e7c59ad7af6ff94c2f5585528e69 Mon Sep 17 00:00:00 2001 From: JiangRu Date: Fri, 16 Jan 2015 16:44:23 +0800 Subject: [PATCH] add param files & links for index and widget --- app/controllers/announcements_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 5bbc1fc..3132cfb 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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,