Fix preview with attatched file

This commit is contained in:
manson 2014-06-24 15:57:27 +08:00
parent c846599f3b
commit 837c14739d
2 changed files with 3 additions and 2 deletions

View File

@ -88,8 +88,10 @@ class Admin::AnnouncementsController < OrbitAdminController
file.bulletin_id = bulletin.id
file.save
else
file = BulletinFile.find(bulletin_file['id']).clone
org_file = BulletinFile.find(bulletin_file['id'])
file = org_file.clone
file.bulletin_id = bulletin.id
file.file = org_file.file
bulletin_file.delete('id')
bulletin_file.delete('_destroy')
file.update_attributes(bulletin_file)

View File

@ -61,7 +61,6 @@ class AnnouncementsController < ApplicationController
files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue []
links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
update_user = announcement.update_user.member_profile.name rescue ""
# announcement.destroy if announcement.is_preview
{
"tags" => tags,
"bulletin_files" => files,