|
|
@ -629,32 +629,16 @@ class FilesController < ApplicationController
|
|
|
|
# redirect_to org_subfield_files_url(@org_subfield)
|
|
|
|
# redirect_to org_subfield_files_url(@org_subfield)
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif @organization
|
|
|
|
# 组织添加附件,为了修改图片
|
|
|
|
|
|
|
|
elsif params[:organization_id]
|
|
|
|
|
|
|
|
@organization = Organization.find(params[:organization_id])
|
|
|
|
@addTag=false
|
|
|
|
@addTag=false
|
|
|
|
attachments = Attachment.attach_filesex(@organization, params[:attachments], params[:org_attachment_type])
|
|
|
|
# atttchment_type = 0为logo 1为banner
|
|
|
|
|
|
|
|
if params[:logo]
|
|
|
|
if params[:org_attachment_type] && params[:org_attachment_type].is_a?(Array)
|
|
|
|
attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
|
|
|
|
params[:org_attachment_type].each do |type|
|
|
|
|
|
|
|
|
tag_name = get_tag_name_by_type_number type
|
|
|
|
|
|
|
|
if !attachments.empty? && attachments[:files] && tag_name != ""
|
|
|
|
|
|
|
|
attachments[:files].each do |attachment|
|
|
|
|
|
|
|
|
attachment.tag_list.add(tag_name)
|
|
|
|
|
|
|
|
attachment.save
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if params[:org_attachment_type] && params[:org_attachment_type] != "5"
|
|
|
|
attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
|
|
|
|
tag_name = get_tag_name_by_type_number params[:org_attachment_type]
|
|
|
|
|
|
|
|
if !attachments.empty? && attachments[:files] && tag_name != ""
|
|
|
|
|
|
|
|
attachments[:files].each do |attachment|
|
|
|
|
|
|
|
|
attachment.tag_list.add(tag_name)
|
|
|
|
|
|
|
|
attachment.save
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: 临时用 nyan
|
|
|
|
# TODO: 临时用 nyan
|
|
|
|
sort_init 'created_on', 'desc'
|
|
|
|
sort_init 'created_on', 'desc'
|
|
|
|
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
|
|
|
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
|
|
|