Skip to content

Commit

Permalink
Merge branch 'master' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Oct 24, 2024
2 parents e2225ad + 832ec06 commit b8e2d5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions app/controllers/dmsf_upload_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,28 @@ def permissions

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
Expand Down
6 changes: 5 additions & 1 deletion assets/javascripts/attachments_dmsf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion lib/redmine_dmsf/hooks/views/issue_view_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,13 @@ def attachment_row(dmsf_file, link, issue, controller)
if issue.attributes_editable? && ((link && User.current.allowed_to?(:file_manipulation,
dmsf_file.project)) || (!link &&
User.current.allowed_to?(:file_delete, dmsf_file.project)))
url = if link
dmsf_link_path link, commit: 'yes', back_url: issue_path(issue)
else
dmsf_file_path id: dmsf_file, commit: 'yes', back_url: issue_path(issue)
end
html << link_to('',
link ? dmsf_link_path(link, commit: 'yes', back_url: issue_path(issue)) : dmsf_file_path(id: dmsf_file, commit: 'yes', back_url: issue_path(issue)),
url,
data: { confirm: l(:text_are_you_sure) },
method: :delete,
title: l(:button_delete),
Expand Down

0 comments on commit b8e2d5c

Please sign in to comment.