Deleting of uploaded files #1558
This commit is contained in:
parent
d866adf96d
commit
177e260bfa
@ -41,25 +41,28 @@ class DmsfUploadController < ApplicationController
|
||||
|
||||
def upload_files
|
||||
uploaded_files = params[:dmsf_attachments]
|
||||
@uploads = []
|
||||
# Commit
|
||||
if params[:commit] == l(:label_dmsf_upload_commit)
|
||||
uploaded_files&.each do |key, uploaded_file|
|
||||
upload = DmsfUpload.create_from_uploaded_attachment(@project, @folder, uploaded_file)
|
||||
next unless upload
|
||||
|
||||
@uploads.push upload
|
||||
params[:committed_files][key][:disk_filename] = upload.disk_filename
|
||||
params[:committed_files][key][:digest] = upload.digest
|
||||
params[:committed_files][key][:tempfile_path] = upload.tempfile_path
|
||||
end
|
||||
commit_files
|
||||
commit_files if params[:committed_files].present?
|
||||
# Upload
|
||||
else
|
||||
@uploads = []
|
||||
# standard file input uploads
|
||||
uploaded_files&.each do |_, uploaded_file|
|
||||
upload = DmsfUpload.create_from_uploaded_attachment(@project, @folder, uploaded_file)
|
||||
@uploads.push(upload) if upload
|
||||
end
|
||||
flash.now[:error] = "#{l(:label_attachment)} #{l('activerecord.errors.messages.invalid')}" if @uploads.empty?
|
||||
end
|
||||
flash.now[:error] = "#{l(:label_attachment)} #{l('activerecord.errors.messages.invalid')}" if @uploads.empty?
|
||||
end
|
||||
|
||||
# REST API and Redmine attachment form
|
||||
|
||||
@ -306,7 +306,11 @@ dmsfAjaxUpload.uploading = 0;
|
||||
|
||||
function dmsfRemoveFileLbl() {
|
||||
|
||||
$(this).parent('span').remove();
|
||||
let span = $(this).parent('span');
|
||||
|
||||
span.next('div').remove();
|
||||
span.next('br').remove();
|
||||
span.remove();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user