New content input field improvement #1343
This commit is contained in:
parent
e9a8375911
commit
20208c8bf8
@ -66,13 +66,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box" id="file_upload_box">
|
<p>
|
||||||
<p>
|
<%= label_tag 'file_upload', l(:label_new_content) %>
|
||||||
<%= label_tag 'file_upload', l(:label_new_content) %>
|
<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, description: false, awf: false } %>
|
||||||
</p>
|
</span>
|
||||||
</div>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: 'wiki-edit dmsf-description' %>
|
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: 'wiki-edit dmsf-description' %>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -50,8 +50,9 @@ dmsfAddLink.nextLinkId = 1000;
|
|||||||
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
|
||||||
|
|
||||||
if (attachments.children().length < 10) {
|
if (attachments.children().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' });
|
||||||
@ -59,9 +60,9 @@ function dmsfAddFile(inputEl, file, eagerUpload) {
|
|||||||
let fileName = $('<input>', {type: 'text', 'class': 'filename readonly',
|
let fileName = $('<input>', {type: 'text', 'class': 'filename readonly',
|
||||||
name: 'dmsf_attachments[' + attachmentId + '][filename]', readonly: 'readonly'}).val(file.name);
|
name: 'dmsf_attachments[' + attachmentId + '][filename]', readonly: 'readonly'}).val(file.name);
|
||||||
|
|
||||||
if($(inputEl).attr('multiple') == 'multiple') {
|
fileSpan.append(fileName);
|
||||||
|
|
||||||
fileSpan.append(fileName);
|
if($(inputEl).attr('multiple') == 'multiple') {
|
||||||
|
|
||||||
if($(inputEl).data('description')) {
|
if($(inputEl).data('description')) {
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ function dmsfAddFile(inputEl, file, eagerUpload) {
|
|||||||
attachments.append(fileSpan);
|
attachments.append(fileSpan);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fileSpan.append(fileName);
|
fileSpan.append(iconDel.click(dmsfRemoveFileLbl));
|
||||||
attachments.append(fileSpan);
|
attachments.append(fileSpan);
|
||||||
$('#dmsf_file_revision_name').val(file.name);
|
$('#dmsf_file_revision_name').val(file.name);
|
||||||
}
|
}
|
||||||
@ -216,15 +217,8 @@ function dmsfAddInputFiles(inputEl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(inputEl).attr('multiple') == 'multiple') {
|
clearedFileInput.val('');
|
||||||
|
addFileSpan.prepend(clearedFileInput);
|
||||||
clearedFileInput.val('');
|
|
||||||
addFileSpan.prepend(clearedFileInput);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
addFileSpan.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dmsfUploadAndAttachFiles(files, inputEl) {
|
function dmsfUploadAndAttachFiles(files, inputEl) {
|
||||||
|
|||||||
@ -251,6 +251,11 @@ div[id*="revision_access_"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* DMSF file upload */
|
/* DMSF file upload */
|
||||||
|
|
||||||
|
span.fileover {
|
||||||
|
background-color: lavender;
|
||||||
|
}
|
||||||
|
|
||||||
.dmsf-uploader {
|
.dmsf-uploader {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user