From a56fcc33a24c93cc9bef4bcd2d5dae000eb43d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 20 Sep 2024 09:02:11 +0200 Subject: [PATCH] #1548 '[+]' icon and help --- app/views/dmsf_files/show.html.erb | 12 ++++-------- assets/help/en/dmsf_help.html | 13 ++++++++----- assets/javascripts/attachments_dmsf.js | 25 +++++++++++++++---------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index 583a5739..76bb9aef 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -187,13 +187,9 @@ } }); $('#new_revision_form_content_toggle').click(function() { - if($('#new_revision_form_content').is(':visible')) { - $(this).text('[+]'); - $('#new_revision_form_content').hide(); - } - else { - $(this).text('[-]'); - $('#new_revision_form_content').show(); - } + let newRevisionForm = $('#new_revision_form_content'); + let operator = newRevisionForm.is(':visible') ? '+' : '-'; + $(this).text('[' + operator + ']'); + newRevisionForm.toggle(); }); <% end %> diff --git a/assets/help/en/dmsf_help.html b/assets/help/en/dmsf_help.html index d621a12c..9bce4b72 100644 --- a/assets/help/en/dmsf_help.html +++ b/assets/help/en/dmsf_help.html @@ -411,14 +411,17 @@

5.11 Add documents

Click on the green plus icon New document in the top right of the main view. Then you can use the - Browse button or simple drag and drop files into the drop-able area. Multiple files ca be - selected. + Browse button or simple drag and drop files into the drop-able area. Multiple files can be selected.

- Recently uploaded files ar listed on the screen. You optionally add a description or delete them if they were - selected by mistake. When done, click the Uplad button. + Recently uploaded files ar listed on the screen. You can delete them, if they were + selected by mistake using the trash bin icon. When done, click the Uplad button.

- + If you use [+] icon, you can specify document's details and then you can directly use Commit button. + In that case the following commit screeen will be skipped and uploaded documents will be directly stored. +

+ Upload

Once the new files are uploaded, corresponding documents are created. Here you can specify additional attributes diff --git a/assets/javascripts/attachments_dmsf.js b/assets/javascripts/attachments_dmsf.js index 7ac8b73c..333c569d 100644 --- a/assets/javascripts/attachments_dmsf.js +++ b/assets/javascripts/attachments_dmsf.js @@ -136,11 +136,14 @@ function dmsfAddFile(inputEl, file, eagerUpload) { fileSpan.append(iconDel.click(dmsfRemoveFileLbl)); - if($(inputEl).data('awf')) { + if ($(inputEl).data('awf')) { - let iconWf = $('').attr({href: '/dmsf-workflows/' + $(inputEl).attr( - 'data-project') + "/assign?attachment_id=" + attachmentId, 'class': 'modify-upload icon-only icon-ok', - 'data-remote': 'true'}); + let iconWf = $('').attr({ + href: '/dmsf-workflows/' + $(inputEl).attr( + 'data-project') + "/assign?attachment_id=" + attachmentId, + 'class': 'modify-upload icon-only icon-ok', + 'data-remote': 'true' + }); fileSpan.append(iconWf); } @@ -149,12 +152,15 @@ function dmsfAddFile(inputEl, file, eagerUpload) { let detailsForm = $(inputEl).data('dmsf-file-details-form'); let detailsDiv = $('

').attr({id: 'dmsf_attachments_details_' + attachmentId}); let detailsArrow = $(''); - - detailsArrow.attr({href: '#', 'class': 'icon-only icon-sorted-asc', title: 'Details'}); + + detailsArrow.text('[+]'); + detailsArrow.attr({href: "#", 'data-cy': 'toggle__new_revision_from_content--dmsf', title: 'Details'}); detailsArrow.attr( { - onclick: "$('#dmsf_attachments_details_" + attachmentId + "').toggle();" + - "$(this).toggleClass('icon-sorted-asc');$(this).toggleClass('icon-sorted-desc');" + + onclick: "let newRevisionForm = $('#dmsf_attachments_details_" + attachmentId + "');" + + "let operator = newRevisionForm.is(':visible') ? '+' : '-';" + + "newRevisionForm.toggle();" + + "$(this).text('[' + operator + ']');" + "$('#dmsf-upload-button').hide();" + "return false;" }); @@ -185,8 +191,7 @@ function dmsfAddFile(inputEl, file, eagerUpload) { fileSpan.append(detailsArrow) attachments.append(fileSpan); attachments.append(detailsDiv); - } - else{ + } else { fileSpan.append(iconDel.click(dmsfRemoveFileLbl)); attachments.append(fileSpan); $('#dmsf_file_revision_name').val(file.name);