Serialization of attached documents is wrong #1601
This commit is contained in:
parent
1b57325563
commit
138715dba2
@ -334,7 +334,6 @@ class DmsfFilesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def thumbnail
|
def thumbnail
|
||||||
if @file.image?
|
|
||||||
tbnail = @file.thumbnail(size: params[:size])
|
tbnail = @file.thumbnail(size: params[:size])
|
||||||
if tbnail
|
if tbnail
|
||||||
if stale?(etag: tbnail)
|
if stale?(etag: tbnail)
|
||||||
@ -346,9 +345,6 @@ class DmsfFilesController < ApplicationController
|
|||||||
else
|
else
|
||||||
head :not_found
|
head :not_found
|
||||||
end
|
end
|
||||||
else
|
|
||||||
head :not_found
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -499,7 +499,7 @@ class DmsfFile < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def thumbnailable?
|
def thumbnailable?
|
||||||
image? && Redmine::Thumbnail.convert_available?
|
Redmine::Thumbnail.convert_available? && (image? || (pdf? && Redmine::Thumbnail.gs_available?))
|
||||||
end
|
end
|
||||||
|
|
||||||
def previewable?
|
def previewable?
|
||||||
@ -592,8 +592,6 @@ class DmsfFile < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def thumbnail(options = {})
|
def thumbnail(options = {})
|
||||||
return unless image?
|
|
||||||
|
|
||||||
size = options[:size].to_i
|
size = options[:size].to_i
|
||||||
if size.positive?
|
if size.positive?
|
||||||
# Limit the number of thumbnails per image
|
# Limit the number of thumbnails per image
|
||||||
@ -606,7 +604,7 @@ class DmsfFile < ApplicationRecord
|
|||||||
size = 100 unless size.positive?
|
size = 100 unless size.positive?
|
||||||
target = File.join(Attachment.thumbnails_storage_path, "#{id}_#{last_revision.digest}_#{size}.thumb")
|
target = File.join(Attachment.thumbnails_storage_path, "#{id}_#{last_revision.digest}_#{size}.thumb")
|
||||||
begin
|
begin
|
||||||
Redmine::Thumbnail.generate last_revision.disk_file.to_s, target, size
|
Redmine::Thumbnail.generate last_revision.disk_file.to_s, target, size, pdf?
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
Rails.logger.error do
|
Rails.logger.error do
|
||||||
%(An error occured while generating thumbnail for #{last_revision.disk_file} to #{target}\n
|
%(An error occured while generating thumbnail for #{last_revision.disk_file} to #{target}\n
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
<%= label_tag 'file_upload', l(:label_new_content) %>
|
<%= label_tag 'file_upload', l(:label_new_content) %>
|
||||||
<span class="dmsf-uploader">
|
<span class="dmsf-uploader">
|
||||||
<%= render partial: 'dmsf_upload/form',
|
<%= render partial: 'dmsf_upload/form',
|
||||||
locals: { multiple: false, container: nil, description: false, awf: false } %>
|
locals: { multiple: false, container: nil, awf: false } %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@ -27,7 +27,7 @@ var awf = false;
|
|||||||
<% file = @dmsf_link.target_file %>
|
<% file = @dmsf_link.target_file %>
|
||||||
<% if file && !file.locked? && User.current.allowed_to?(:file_approval, file.project) %>
|
<% if file && !file.locked? && User.current.allowed_to?(:file_approval, file.project) %>
|
||||||
<% revision = file.last_revision %>
|
<% revision = file.last_revision %>
|
||||||
<% if revision && revision.workflow.nil? %>
|
<% if revision&.workflow.nil? %>
|
||||||
awf = true;
|
awf = true;
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -17,22 +17,32 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<span id="dmsf_attachments_fields">
|
<span class="dmsf-attachments-icons hidden">
|
||||||
|
<%= sprite_icon('del', icon_only: true, css_class: 'svg-del') %>
|
||||||
|
<%= sprite_icon('attachment', icon_only: true, size: 16, css_class: 'svg-attachment') %>
|
||||||
|
<%= sprite_icon('checked', icon_only: true, size: 16, css_class: 'svg-dmsf-assignment') %>
|
||||||
|
<%= sprite_icon('link', icon_only: true, size: 16, css_class: 'svg-dmsf-link') %>
|
||||||
|
</span>
|
||||||
|
<span id="dmsf_attachments_fields" class="attachments_fields">
|
||||||
<% if defined?(container) && container && container.saved_dmsf_attachments.present? %>
|
<% if defined?(container) && container && container.saved_dmsf_attachments.present? %>
|
||||||
<% container.saved_dmsf_attachments.each_with_index do |attachment, i| %>
|
<% container.saved_dmsf_attachments.each_with_index do |attachment, i| %>
|
||||||
|
<% i += 1 %>
|
||||||
<span id="dmsf_attachments_p<%= i %>" class="attachment">
|
<span id="dmsf_attachments_p<%= i %>" class="attachment">
|
||||||
<%= hidden_field_tag "dmsf_attachments[p#{i}][token]", "#{attachment.token}" %>
|
<%= hidden_field_tag "dmsf_attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||||
<%= text_field_tag("dmsf_attachments[p#{i}][filename]", attachment.filename, class: 'filename') %>
|
<%= sprite_icon('attachment', icon_only: true, size: 16, css_class: 'svg-attachment') %>
|
||||||
<%= text_field_tag("dmsf_attachments[p#{i}][description]", attachment.description, maxlength: 255,
|
<%= text_field_tag("dmsf_attachments[p#{i}][filename]", attachment.filename,
|
||||||
placeholder: l(:label_optional_description), class: 'description') if description %>
|
class: 'filename icon icon-attachment readonly') %>
|
||||||
<%= link_to '', dmsf_attachment_path(attachment, attachment_id: "p#{i}", format: 'js'),
|
<%= link_to sprite_icon('del', l(:button_delete), icon_only: true),
|
||||||
|
dmsf_attachment_path(attachment, attachment_id: "p#{i}", format: 'js'),
|
||||||
method: 'delete', remote: true, class: 'remove-upload icon-only icon-del' %>
|
method: 'delete', remote: true, class: 'remove-upload icon-only icon-del' %>
|
||||||
<% wf = container.saved_dmsf_attachments_wfs[attachment.id] %>
|
<% wf = container.saved_dmsf_attachments_wfs[attachment.id] %>
|
||||||
<% if wf %>
|
<% if wf %>
|
||||||
<a href="javascript:void(0);" title="<%= l(:title_assigned) %>" class="icon-only icon-ok"></a>
|
<%= link_to sprite_icon('checked', l(:title_assigned), icon_only: true), '#', remote: true,
|
||||||
<%= hidden_field_tag("dmsf_attachments_wfs[p#{i}]", wf.id) if wf %>
|
class: 'modify-upload icon-only icon-ok' %>
|
||||||
|
<%= hidden_field_tag("dmsf_attachments_wfs[p#{i}]", wf.id) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to '', assign_dmsf_workflow_path(id: container.project.id, project_id: container.project.id,
|
<%= link_to sprite_icon('checked', l(:title_assignment), icon_only: true),
|
||||||
|
assign_dmsf_workflow_path(id: container.project.id, project_id: container.project.id,
|
||||||
attachment_id: i + 1), title: l(:label_dmsf_wokflow_action_assign),
|
attachment_id: i + 1), title: l(:label_dmsf_wokflow_action_assign),
|
||||||
remote: true, class: 'modify-upload icon-only icon-ok' %>
|
remote: true, class: 'modify-upload icon-only icon-ok' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -41,18 +51,19 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span id="dmsf_links_attachments_fields">
|
<span id="dmsf_links_attachments_fields" class="attachments_fields">
|
||||||
<% if defined?(container) && container && container.saved_dmsf_links.present? %>
|
<% if defined?(container) && container && container.saved_dmsf_links.present? %>
|
||||||
<% container.saved_dmsf_links.each_with_index do |dmsf_link, index| %>
|
<% container.saved_dmsf_links.each_with_index do |dmsf_link, index| %>
|
||||||
<span id="dmsf_links_attachments_<%= index %>" class="attachment">
|
<span id="dmsf_links_attachments_<%= index %>" class="attachment">
|
||||||
<input name="dmsf_links[<%= index %>]" value="<%= dmsf_link.id %>" type="hidden">
|
<input name="dmsf_links[<%= index %>]" value="<%= dmsf_link.id %>" type="hidden">
|
||||||
<input type="text" class='filename readonly' value="<%= dmsf_link.name %>">
|
<input type="text" class='filename readonly' value="<%= dmsf_link.name %>">
|
||||||
<%= link_to '', dmsf_link_attachment_path(dmsf_link, link_id: "#{index}", :format => 'js'),
|
<%= link_to '', dmsf_link_attachment_path(dmsf_link, link_id: "#{index}", format: 'js'),
|
||||||
method: 'delete', remote: true, class: 'remove-upload icon-only icon-del' %>
|
method: 'delete', remote: true, class: 'remove-upload icon-only icon-del' %>
|
||||||
<% wf = container.saved_dmsf_links_wfs[dmsf_link.id] %>
|
<% wf = container.saved_dmsf_links_wfs[dmsf_link.id] %>
|
||||||
<% if wf %>
|
<% if wf %>
|
||||||
<a href="javascript:void(0);" title="<%= l(:title_assigned) %>" class="modify-upload icon-only icon-ok"></a>
|
<%= link_to sprite_icon('checked', l(:title_assigned), icon_only: true), '#', remote: true,
|
||||||
<%= hidden_field_tag("dmsf_links_wfs[#{dmsf_link.id}]", wf.id) if wf %>
|
class: 'modify-upload icon-only icon-ok' %>
|
||||||
|
<%= hidden_field_tag("dmsf_links_wfs[#{dmsf_link.id}]", wf.id) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render partial: 'dmsf_workflows/approval_workflow_button',
|
<%= render partial: 'dmsf_workflows/approval_workflow_button',
|
||||||
locals: { file: dmsf_link.target_file,
|
locals: { file: dmsf_link.target_file,
|
||||||
@ -63,7 +74,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="dmsf_add_attachment add_attachment">
|
<span class="dmsf_add_attachment add_attachment">
|
||||||
@ -97,7 +108,6 @@
|
|||||||
max_size: number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
max_size: number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||||
max_concurrent_uploads: Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
max_concurrent_uploads: Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
upload_path: dmsf_uploads_path(format: 'js'),
|
upload_path: dmsf_uploads_path(format: 'js'),
|
||||||
description_placeholder: l(:label_optional_description),
|
|
||||||
project: project.identifier,
|
project: project.identifier,
|
||||||
awf: awf,
|
awf: awf,
|
||||||
dmsf_file_details_form: controller.send(:render_to_string,
|
dmsf_file_details_form: controller.send(:render_to_string,
|
||||||
|
|||||||
@ -17,15 +17,13 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
%>
|
%>
|
||||||
|
|
||||||
let input;
|
|
||||||
|
|
||||||
<% if @dmsf_link_id %>
|
<% if @dmsf_link_id %>
|
||||||
input = $('input[value="<%= @dmsf_link_id %>"]');
|
var input = $('input[value="<%= @dmsf_link_id %>"]');
|
||||||
<% else %>
|
<% else %>
|
||||||
input = $('input[name="dmsf_attachments[<%= @attachment_id %>][token]"]');
|
var input = $('input[name="dmsf_attachments[<%= @attachment_id %>][token]"]');
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
let span = input.parent();
|
var span = input.parent();
|
||||||
|
|
||||||
<% if @dmsf_link_id %>
|
<% if @dmsf_link_id %>
|
||||||
span.append(
|
span.append(
|
||||||
@ -35,7 +33,7 @@ let span = input.parent();
|
|||||||
"<input name='dmsf_attachments_wfs[<%= @attachment_id %>]' value='<%= @dmsf_workflow_id %>' type='hidden'>");
|
"<input name='dmsf_attachments_wfs[<%= @attachment_id %>]' value='<%= @dmsf_workflow_id %>' type='hidden'>");
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
let a = span.children("a.icon-ok");
|
var a = span.children("a.icon-ok");
|
||||||
|
|
||||||
a.attr("href", "javascript:void(0);");
|
a.attr("href", "#");
|
||||||
a.attr("title", "<%= l(:title_assigned) %>");
|
a.attr("title", "<%= l(:title_assigned) %>");
|
||||||
|
|||||||
@ -18,17 +18,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function dmsfAddLink(linksSpan, linkId, linkName, title, project, awf) {
|
function dmsfAddLink(linksSpan, linkId, linkName, title, project, awf) {
|
||||||
|
let attachmentsForm = linksSpan.closest('.dmsf-uploader')
|
||||||
|
let attachmentsIcons = attachmentsForm.find('.dmsf-attachments-icons');
|
||||||
|
let delIcon = attachmentsIcons.find('svg.svg-del').clone();
|
||||||
|
let linkIcon = attachmentsIcons.find('svg.svg-dmsf-link').clone();
|
||||||
|
let assignmentIcon = attachmentsIcons.find('svg.svg-dmsf-assignment').clone();
|
||||||
let nextLinkId = dmsfAddLink.nextLinkId++;
|
let nextLinkId = dmsfAddLink.nextLinkId++;
|
||||||
let linkSpan = $('<span>', { id: 'dmsf_links_attachments_' + nextLinkId, 'class': 'attachment' });
|
let linkSpan = $('<span>', { id: 'dmsf_links_attachments_' + nextLinkId, 'class': 'attachment' });
|
||||||
let iconDel = $('<a>').attr({href: '#', 'class': 'remove-upload icon-only icon-del'});
|
let iconDel = $('<a>')
|
||||||
|
.attr({href: '#', class: 'remove-upload icon-only icon-del', title: 'Delete'})
|
||||||
|
.append(delIcon);
|
||||||
let inputId = $('<input>', {type: 'hidden', name: 'dmsf_links[' + nextLinkId + ']'}).val(linkId);
|
let inputId = $('<input>', {type: 'hidden', name: 'dmsf_links[' + nextLinkId + ']'}).val(linkId);
|
||||||
let inputName = $('<input>', {type: 'text', class: 'filename readonly'}).val(linkName);
|
let inputName = $('<input>', {type: 'text', class: 'filename icon icon-link readonly'}).val(linkName);
|
||||||
linkSpan.append(inputId);
|
linkSpan.append(inputId);
|
||||||
|
linkSpan.append(linkIcon);
|
||||||
linkSpan.append(inputName);
|
linkSpan.append(inputName);
|
||||||
linkSpan.append(iconDel.click(dmsfRemoveFileLbl));
|
linkSpan.append(iconDel.click(dmsfRemoveFileLbl));
|
||||||
if(awf) {
|
if(awf) {
|
||||||
let iconWf = $('<a>').attr({href: "/dmsf-workflows/" + project + "/assign?dmsf_link_id=" + linkId,
|
let iconWf = $('<a>').attr({href: "/dmsf_workflows/" + project + "/assign?dmsf_link_id=" + linkId,
|
||||||
'class': 'modify-upload icon-only icon-ok', 'data-remote': 'true', 'title': title});
|
'class': 'modify-upload icon-only icon-ok', 'data-remote': 'true', 'title': title}).append(assignmentIcon);
|
||||||
linkSpan.append(iconWf);
|
linkSpan.append(iconWf);
|
||||||
}
|
}
|
||||||
linksSpan.append(linkSpan);
|
linksSpan.append(linkSpan);
|
||||||
@ -137,41 +145,50 @@ function replaceVersion(detailsForm, attachmentId, name, version) {
|
|||||||
return detailsForm;
|
return detailsForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dmsfRevisionDetails(elem, attachmentId) {
|
||||||
|
let newRevisionForm = $('#dmsf_attachments_details_' + attachmentId);
|
||||||
|
newRevisionForm.toggle();
|
||||||
|
elem.text("[" + (newRevisionForm.is(':visible') ? "-" : "+") + "]");
|
||||||
|
}
|
||||||
|
|
||||||
function dmsfAddFile(inputEl, file, eagerUpload) {
|
function dmsfAddFile(inputEl, file, eagerUpload) {
|
||||||
let attachments = $('#dmsf_attachments_fields');
|
let attachments = $('#dmsf_attachments_fields');
|
||||||
let max = ($(inputEl).attr('multiple') == 'multiple') ? 10 : 1
|
let max = ($(inputEl).attr('multiple') == 'multiple') ? 10 : 1
|
||||||
|
let attachmentsForm = $(inputEl).closest('.dmsf-uploader')
|
||||||
|
let attachmentsIcons = attachmentsForm.find('.dmsf-attachments-icons');
|
||||||
|
let delIcon = attachmentsIcons.find('svg.svg-del').clone();
|
||||||
|
let attachmentIcon = attachmentsIcons.find('svg.svg-attachment').clone();
|
||||||
|
let assignmentIcon = attachmentsIcons.find('svg.svg-dmsf-assignment').clone();
|
||||||
if (attachments.children('.attachment').length < max) {
|
if (attachments.children('.attachment').length < max) {
|
||||||
let attachmentId = dmsfAddFile.nextAttachmentId++;
|
let attachmentId = dmsfAddFile.nextAttachmentId++;
|
||||||
let fileSpan = $('<span>', { id: 'dmsf_attachments_' + attachmentId, 'class': 'attachment' });
|
let fileSpan = $('<span>', { id: 'dmsf_attachments_' + attachmentId, 'class': 'attachment' });
|
||||||
let iconDel = $('<a>').attr({href: '#', 'class': 'remove-upload icon-only icon-del'}).toggle(!eagerUpload);
|
let iconDel = $('<a>')
|
||||||
let fileName = $('<input>', {type: 'text', 'class': 'filename readonly',
|
.attr({href: '#', class: 'remove-upload icon-only icon-del', title: 'Delete'})
|
||||||
|
.append(delIcon)
|
||||||
|
.toggle(!eagerUpload);
|
||||||
|
let fileName = $('<input>', {type: 'text', 'class': 'filename icon icon-attachment readonly',
|
||||||
name: 'dmsf_attachments[' + attachmentId + '][filename]', readonly: 'readonly'}).val(file.name);
|
name: 'dmsf_attachments[' + attachmentId + '][filename]', readonly: 'readonly'}).val(file.name);
|
||||||
|
fileSpan.append(attachmentIcon);
|
||||||
fileSpan.append(fileName);
|
fileSpan.append(fileName);
|
||||||
if($(inputEl).attr('multiple') == 'multiple') {
|
if($(inputEl).attr('multiple') == 'multiple') {
|
||||||
fileSpan.append(iconDel.click(dmsfRemoveFileLbl));
|
fileSpan.append(iconDel.click(dmsfRemoveFileLbl));
|
||||||
if ($(inputEl).data('awf')) {
|
if ($(inputEl).data('awf')) {
|
||||||
let iconWf = $('<a>').attr({
|
let iconWf = $('<a>').attr({
|
||||||
href: '/dmsf-workflows/' + $(inputEl).attr(
|
href: '/dmsf_workflows/' + $(inputEl).attr(
|
||||||
'data-project') + "/assign?attachment_id=" + attachmentId,
|
'data-project') + "/assign?attachment_id=" + attachmentId,
|
||||||
'class': 'modify-upload icon-only icon-ok',
|
class: 'modify-upload icon-only icon-ok',
|
||||||
'data-remote': 'true'
|
'data-remote': 'true',
|
||||||
});
|
title: 'Assign an approval workflow'
|
||||||
|
}).append(assignmentIcon);
|
||||||
fileSpan.append(iconWf);
|
fileSpan.append(iconWf);
|
||||||
}
|
}
|
||||||
// Details
|
// Details
|
||||||
let detailsDiv = $('<div>').attr({id: 'dmsf_attachments_details_' + attachmentId});
|
let detailsDiv = $('<div>').attr({id: 'dmsf_attachments_details_' + attachmentId});
|
||||||
let detailsArrow = $('<a>');
|
let detailsArrow = $('<a>');
|
||||||
detailsArrow.text('[+]');
|
detailsArrow.text('[+]');
|
||||||
detailsArrow.attr({href: "#", 'data-cy': 'toggle__new_revision_from_content--dmsf', title: 'Details'});
|
detailsArrow.attr({href: "#", 'data-cy': 'toggle__new_revision_from_content--dmsf', title: 'Details',
|
||||||
detailsArrow.attr(
|
class: 'dmsf-plus-button'});
|
||||||
{
|
detailsArrow.attr('onclick', "dmsfRevisionDetails($(this), " + attachmentId + "); return false;");
|
||||||
onclick: "let newRevisionForm = $('#dmsf_attachments_details_" + attachmentId + "');" +
|
|
||||||
"let operator = newRevisionForm.is(':visible') ? '+' : '-';" +
|
|
||||||
"newRevisionForm.toggle();" +
|
|
||||||
"$(this).text('[' + operator + ']');" +
|
|
||||||
"$('#dmsf-upload-button').hide();" +
|
|
||||||
"return false;"
|
|
||||||
});
|
|
||||||
let files = $(inputEl).data('files');
|
let files = $(inputEl).data('files');
|
||||||
let locked = isFileLocked(file.name, files);
|
let locked = isFileLocked(file.name, files);
|
||||||
let detailsForm = $(inputEl).data(locked ? 'dmsf-file-details-form-locked' : 'dmsf-file-details-form');
|
let detailsForm = $(inputEl).data(locked ? 'dmsf-file-details-form-locked' : 'dmsf-file-details-form');
|
||||||
@ -214,7 +231,6 @@ function dmsfAddFile(inputEl, file, eagerUpload) {
|
|||||||
attachments.append(fileSpan);
|
attachments.append(fileSpan);
|
||||||
$('#dmsf_file_revision_name').val(file.name);
|
$('#dmsf_file_revision_name').val(file.name);
|
||||||
}
|
}
|
||||||
attachments.append('<br>');
|
|
||||||
if(eagerUpload) {
|
if(eagerUpload) {
|
||||||
dmsfAjaxUpload(file, attachmentId, fileSpan, inputEl);
|
dmsfAjaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,6 +189,10 @@ div[id*="revision_access_"] {
|
|||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dmsf-gray svg {
|
||||||
|
stroke: grey;
|
||||||
|
}
|
||||||
|
|
||||||
svg.dmsf-gray {
|
svg.dmsf-gray {
|
||||||
stroke: grey;
|
stroke: grey;
|
||||||
}
|
}
|
||||||
@ -286,7 +290,10 @@ span.fileover {
|
|||||||
width: 250px;
|
width: 250px;
|
||||||
color: #555;
|
color: #555;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
padding-left: 18px;
|
}
|
||||||
|
|
||||||
|
.dmsf-plus-button {
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dmsf_attachments_fields div.ui-progressbar {
|
#dmsf_attachments_fields div.ui-progressbar {
|
||||||
@ -307,7 +314,11 @@ span.fileover {
|
|||||||
width: 250px;
|
width: 250px;
|
||||||
color: #555;
|
color: #555;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
padding-left: 18px;
|
}
|
||||||
|
|
||||||
|
.attachments_fields .icon-link {
|
||||||
|
background-image: none;
|
||||||
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dmfs-box-tabular {
|
.dmfs-box-tabular {
|
||||||
|
|||||||
@ -157,7 +157,7 @@ module RedmineDmsf
|
|||||||
# Attach DMS documents
|
# Attach DMS documents
|
||||||
uploaded_files = params[:dmsf_attachments]
|
uploaded_files = params[:dmsf_attachments]
|
||||||
details = params[:committed_files]
|
details = params[:committed_files]
|
||||||
if uploaded_files && details
|
if uploaded_files
|
||||||
system_folder = issue.system_folder(create: true)
|
system_folder = issue.system_folder(create: true)
|
||||||
uploaded_files.each do |key, uploaded_file|
|
uploaded_files.each do |key, uploaded_file|
|
||||||
upload = DmsfUpload.create_from_uploaded_attachment(issue.project, system_folder, uploaded_file)
|
upload = DmsfUpload.create_from_uploaded_attachment(issue.project, system_folder, uploaded_file)
|
||||||
@ -166,11 +166,16 @@ module RedmineDmsf
|
|||||||
uploaded_file[:disk_filename] = upload.disk_filename
|
uploaded_file[:disk_filename] = upload.disk_filename
|
||||||
uploaded_file[:name] = upload.name
|
uploaded_file[:name] = upload.name
|
||||||
uploaded_file[:title] = upload.title
|
uploaded_file[:title] = upload.title
|
||||||
|
if details
|
||||||
uploaded_file[:description] = details[key][:description]
|
uploaded_file[:description] = details[key][:description]
|
||||||
uploaded_file[:comment] = details[key][:comment]
|
uploaded_file[:comment] = details[key][:comment]
|
||||||
uploaded_file[:version_major] = details[key][:version_major]
|
uploaded_file[:version_major] = details[key][:version_major]
|
||||||
uploaded_file[:version_minor] = details[key][:version_minor]
|
uploaded_file[:version_minor] = details[key][:version_minor]
|
||||||
uploaded_file[:version_patch] = details[key][:version_patch]
|
uploaded_file[:version_patch] = details[key][:version_patch]
|
||||||
|
else
|
||||||
|
uploaded_file[:version_major] = 0
|
||||||
|
uploaded_file[:version_minor] = 1
|
||||||
|
end
|
||||||
uploaded_file[:size] = upload.size
|
uploaded_file[:size] = upload.size
|
||||||
uploaded_file[:mime_type] = upload.mime_type
|
uploaded_file[:mime_type] = upload.mime_type
|
||||||
uploaded_file[:tempfile_path] = upload.tempfile_path
|
uploaded_file[:tempfile_path] = upload.tempfile_path
|
||||||
@ -178,7 +183,7 @@ module RedmineDmsf
|
|||||||
if params[:dmsf_attachments_wfs].present? && params[:dmsf_attachments_wfs][key].present?
|
if params[:dmsf_attachments_wfs].present? && params[:dmsf_attachments_wfs][key].present?
|
||||||
uploaded_file[:workflow_id] = params[:dmsf_attachments_wfs][key].to_i
|
uploaded_file[:workflow_id] = params[:dmsf_attachments_wfs][key].to_i
|
||||||
end
|
end
|
||||||
uploaded_file[:custom_field_values] = details[key][:custom_field_values]
|
uploaded_file[:custom_field_values] = details[key][:custom_field_values] if details
|
||||||
end
|
end
|
||||||
DmsfUploadHelper.commit_files_internal uploaded_files, issue.project, system_folder, context[:controller],
|
DmsfUploadHelper.commit_files_internal uploaded_files, issue.project, system_folder, context[:controller],
|
||||||
issue, new_object: @new_object
|
issue, new_object: @new_object
|
||||||
|
|||||||
@ -154,14 +154,14 @@ module RedmineDmsf
|
|||||||
link_to: false } }
|
link_to: false } }
|
||||||
end
|
end
|
||||||
|
|
||||||
def attach_documents_form(context, label: true, description: true)
|
def attach_documents_form(context, label: true)
|
||||||
return unless context.is_a?(Hash) && context[:container]
|
return unless context.is_a?(Hash) && context[:container]
|
||||||
|
|
||||||
# Add Dmsf upload form
|
# Add Dmsf upload form
|
||||||
container = context[:container]
|
container = context[:container]
|
||||||
return unless allowed_to_attach_documents(container)
|
return unless allowed_to_attach_documents(container)
|
||||||
|
|
||||||
html = description ? +'<p' : +'<div'
|
html = +'<p'
|
||||||
if User.current.pref.dmsf_attachments_upload_choice == 'Attachments' &&
|
if User.current.pref.dmsf_attachments_upload_choice == 'Attachments' &&
|
||||||
allowed_to_attach_attachments(container)
|
allowed_to_attach_attachments(container)
|
||||||
html << ' style="display: none;"'
|
html << ' style="display: none;"'
|
||||||
@ -177,10 +177,9 @@ module RedmineDmsf
|
|||||||
html << context[:controller].send(:render_to_string, { partial: 'dmsf_upload/form',
|
html << context[:controller].send(:render_to_string, { partial: 'dmsf_upload/form',
|
||||||
locals: { container: container,
|
locals: { container: container,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
description: description,
|
awf: true } })
|
||||||
awf: false } })
|
|
||||||
html << '</span>'
|
html << '</span>'
|
||||||
html << (description ? '</p>' : '</div>')
|
html << '</p>'
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user