From 327c300941f9b929f6b63db64296025a37d88f06 Mon Sep 17 00:00:00 2001 From: manson Date: Mon, 5 May 2014 15:48:49 +0800 Subject: [PATCH] Display bulletin files and links --- app/controllers/announcements_controller.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index a422585..fe41f70 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -35,11 +35,19 @@ class AnnouncementsController < ApplicationController def show params = OrbitHelper.params announcement = Bulletin.can_display.find_by(:uid=>params[:uid]) - { + + files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => file.title } } + links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => link.title } } + + { + "bulletin_files" => files, + "bulletin_links" => links, + "data" => { "title" => announcement.title, - "image" => (announcement.image.blank? ? "" : announcement.image.url), - "body" => announcement.text + "body" =>announcement.text, + "image" => announcement.image.url } + } end end