Fix preview with attatched file
This commit is contained in:
parent
c846599f3b
commit
837c14739d
|
@ -88,8 +88,10 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
file.bulletin_id = bulletin.id
|
file.bulletin_id = bulletin.id
|
||||||
file.save
|
file.save
|
||||||
else
|
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.bulletin_id = bulletin.id
|
||||||
|
file.file = org_file.file
|
||||||
bulletin_file.delete('id')
|
bulletin_file.delete('id')
|
||||||
bulletin_file.delete('_destroy')
|
bulletin_file.delete('_destroy')
|
||||||
file.update_attributes(bulletin_file)
|
file.update_attributes(bulletin_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 []
|
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 []
|
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 ""
|
update_user = announcement.update_user.member_profile.name rescue ""
|
||||||
# announcement.destroy if announcement.is_preview
|
|
||||||
{
|
{
|
||||||
"tags" => tags,
|
"tags" => tags,
|
||||||
"bulletin_files" => files,
|
"bulletin_files" => files,
|
||||||
|
|
Loading…
Reference in New Issue