From dbe168cdac21a52d562709c5ccff83a0e901cad2 Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Mon, 14 Oct 2024 15:30:34 +0530 Subject: [PATCH 1/7] Save widget is made fixed during scroll --- hyrax/app/assets/stylesheets/rdms.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hyrax/app/assets/stylesheets/rdms.scss b/hyrax/app/assets/stylesheets/rdms.scss index 60afdfd9..5bb69a79 100644 --- a/hyrax/app/assets/stylesheets/rdms.scss +++ b/hyrax/app/assets/stylesheets/rdms.scss @@ -328,3 +328,9 @@ form .field-wrapper label[required="required"]::after { .subject-parents, .session-parents, .modality-parents { margin-top: 20px; } + +#savewidget{ + position: sticky; + z-index: 1000; + top: 100px; +} \ No newline at end of file -- GitLab From 115c8122f5f95a2d703fba83865d05ee121038d0 Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Mon, 14 Oct 2024 17:18:03 +0530 Subject: [PATCH 2/7] Disabling the screen from entering new entries while save. --- hyrax/app/assets/javascripts/work_show.js | 96 ++++++++++++++++++----- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/hyrax/app/assets/javascripts/work_show.js b/hyrax/app/assets/javascripts/work_show.js index 4f4a4e83..643b3fd6 100644 --- a/hyrax/app/assets/javascripts/work_show.js +++ b/hyrax/app/assets/javascripts/work_show.js @@ -1,27 +1,87 @@ -$(document).on('ready', function() { - var document_id = $('#download-all').data('document-id'); +$(document).on("ready", function () { + var document_id = $("#download-all").data("document-id"); var intervalId; // Declare intervalId variable in outer scope // Function to check if download is ready function checkDownloadStatus() { - if (document_id) { - $.ajax({ - url: "/download_all/button_ready/" + document_id, - type: 'GET', - dataType: 'json', - success: function(response) { - if (response.is_ready) { - $('#download-all').attr('disabled', false); - clearInterval(intervalId); // Clear the interval - } - }, - error: function(request, error) { - console.error("Request error:", error); - } - }); - } + if (document_id) { + $.ajax({ + url: "/download_all/button_ready/" + document_id, + type: "GET", + dataType: "json", + success: function (response) { + if (response.is_ready) { + $("#download-all").attr("disabled", false); + clearInterval(intervalId); // Clear the interval + } + }, + error: function (request, error) { + console.error("Request error:", error); + }, + }); + } } + $(document).ready(function () { + $("#with_files_submit").click(function () { + // Check if overlay already exists; if not, create it + if ($("#overlay").length === 0) { + // Create overlay element + $("body").append(` + <div id="overlay" class="overlay" style="display: flex;"> + <div class="message"> + The save could take a while. Please do not make any further changes to the form, until the save has completed. + </div> + </div> + `); + + // Add CSS styles dynamically + $("<style>") + .prop("type", "text/css") + .html( + ` + #overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + justify-content: center; + align-items: center; + z-index: 1000; + display: flex; + } + + .message { + background: white; + padding: 20px; + border-radius: 5px; + text-align: center; + font-size: 16px; + width: 350px; + height: 200px; + display: flex; + justify-content: center; + align-items:center; + } + ` + ) + .appendTo("head"); + } + + // Show the overlay + $("#overlay").fadeIn(); // Show the overlay when the button is clicked + + // Hide the overlay when clicking on it + $("#overlay").click(function () { + $(this).fadeOut(function () { + $(this).remove(); // Remove the overlay from the DOM after fading out + }); + }); + }); + }); + // Initial check on document ready checkDownloadStatus(); -- GitLab From 2960a333f1efb667417eb0cf52297d3f609331d1 Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Tue, 15 Oct 2024 17:28:25 +0530 Subject: [PATCH 3/7] Disabling the screen from entering new entries while save. --- hyrax/app/assets/javascripts/work_show.js | 22 +++++-------------- .../views/hyrax/base/_form_progress.html.erb | 8 ++++++- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/hyrax/app/assets/javascripts/work_show.js b/hyrax/app/assets/javascripts/work_show.js index 643b3fd6..7b17e238 100644 --- a/hyrax/app/assets/javascripts/work_show.js +++ b/hyrax/app/assets/javascripts/work_show.js @@ -29,9 +29,6 @@ $(document).on("ready", function () { // Create overlay element $("body").append(` <div id="overlay" class="overlay" style="display: flex;"> - <div class="message"> - The save could take a while. Please do not make any further changes to the form, until the save has completed. - </div> </div> `); @@ -46,30 +43,21 @@ $(document).on("ready", function () { left: 0; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, 0.7); + background-color: rgba(0, 0, 0, 0.1); justify-content: center; align-items: center; z-index: 1000; display: flex; - } - - .message { - background: white; - padding: 20px; - border-radius: 5px; - text-align: center; - font-size: 16px; - width: 350px; - height: 200px; - display: flex; - justify-content: center; - align-items:center; + pointer-events: none; } ` ) .appendTo("head"); } + // Making all fields readonly + $("input, textarea, select").attr("readonly", true); + // Show the overlay $("#overlay").fadeIn(); // Show the overlay when the button is clicked diff --git a/hyrax/app/views/hyrax/base/_form_progress.html.erb b/hyrax/app/views/hyrax/base/_form_progress.html.erb index 2bef7095..d4191435 100644 --- a/hyrax/app/views/hyrax/base/_form_progress.html.erb +++ b/hyrax/app/views/hyrax/base/_form_progress.html.erb @@ -59,9 +59,15 @@ <%# Provide immediate feedback after the form is submitted while the subsequent page is loading %> <div class="panel-footer hidden"> <div class="progress"> - <div class="progress-bar progress-bar-striped progress-bar-complete active"> + <div class="progress-bar progress-bar-striped progress-bar-complete active" style="width:100%"> <span id="form-feedback" aria-live="assertive"><%= t(".saving_your_work") %></span> </div> </div> + + <div id="message"> + <em style="color:red"> + The save could take a while. Please do not make any further changes to the form, until the save has completed. + </em> + </div> </div> </aside> \ No newline at end of file -- GitLab From d6b00812b74f2cca19b248ee05e3fbd374dd467b Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Tue, 15 Oct 2024 17:36:12 +0530 Subject: [PATCH 4/7] Disabling the screen from entering new entries while save. --- hyrax/app/assets/javascripts/work_show.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hyrax/app/assets/javascripts/work_show.js b/hyrax/app/assets/javascripts/work_show.js index 7b17e238..989ddab2 100644 --- a/hyrax/app/assets/javascripts/work_show.js +++ b/hyrax/app/assets/javascripts/work_show.js @@ -56,7 +56,8 @@ $(document).on("ready", function () { } // Making all fields readonly - $("input, textarea, select").attr("readonly", true); + $("input, textarea").attr("readonly", true).addClass("readonly"); + $("select").prop("disabled", true).addClass("readonly"); // Show the overlay $("#overlay").fadeIn(); // Show the overlay when the button is clicked -- GitLab From b3f71061f3e13fb8a0866307eccd296e87f1e136 Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Wed, 16 Oct 2024 10:31:59 +0530 Subject: [PATCH 5/7] Readonly and disabled fields logic removed from overlay during save --- hyrax/app/assets/javascripts/work_show.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hyrax/app/assets/javascripts/work_show.js b/hyrax/app/assets/javascripts/work_show.js index 989ddab2..e69d7b08 100644 --- a/hyrax/app/assets/javascripts/work_show.js +++ b/hyrax/app/assets/javascripts/work_show.js @@ -55,10 +55,6 @@ $(document).on("ready", function () { .appendTo("head"); } - // Making all fields readonly - $("input, textarea").attr("readonly", true).addClass("readonly"); - $("select").prop("disabled", true).addClass("readonly"); - // Show the overlay $("#overlay").fadeIn(); // Show the overlay when the button is clicked -- GitLab From f736880337aa9f8b685fdc223fc614b480034674 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 18 Oct 2024 17:45:45 +0530 Subject: [PATCH 6/7] Move inline styles to stylesheet and messages to locale file --- hyrax/app/assets/stylesheets/rdms.scss | 8 ++++++++ hyrax/app/views/hyrax/base/_form_progress.html.erb | 6 ++---- hyrax/config/locales/hyrax.en.yml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hyrax/app/assets/stylesheets/rdms.scss b/hyrax/app/assets/stylesheets/rdms.scss index 5bb69a79..0990c182 100644 --- a/hyrax/app/assets/stylesheets/rdms.scss +++ b/hyrax/app/assets/stylesheets/rdms.scss @@ -333,4 +333,12 @@ form .field-wrapper label[required="required"]::after { position: sticky; z-index: 1000; top: 100px; +} + +.progress-bar { + width: 100% +} + +.save-warning { + color: red; } \ No newline at end of file diff --git a/hyrax/app/views/hyrax/base/_form_progress.html.erb b/hyrax/app/views/hyrax/base/_form_progress.html.erb index d4191435..49ce2110 100644 --- a/hyrax/app/views/hyrax/base/_form_progress.html.erb +++ b/hyrax/app/views/hyrax/base/_form_progress.html.erb @@ -59,15 +59,13 @@ <%# Provide immediate feedback after the form is submitted while the subsequent page is loading %> <div class="panel-footer hidden"> <div class="progress"> - <div class="progress-bar progress-bar-striped progress-bar-complete active" style="width:100%"> + <div class="progress-bar progress-bar-striped progress-bar-complete active"> <span id="form-feedback" aria-live="assertive"><%= t(".saving_your_work") %></span> </div> </div> <div id="message"> - <em style="color:red"> - The save could take a while. Please do not make any further changes to the form, until the save has completed. - </em> + <em class="save-warning"><%= t(".saving_your_work_warning") %></em> </div> </div> </aside> \ No newline at end of file diff --git a/hyrax/config/locales/hyrax.en.yml b/hyrax/config/locales/hyrax.en.yml index aed44555..ff670979 100644 --- a/hyrax/config/locales/hyrax.en.yml +++ b/hyrax/config/locales/hyrax.en.yml @@ -305,6 +305,7 @@ en: form_progress: required_descriptions: Describe your work (dataset) saving_your_work: Saving your work (dataset). This may take a few moments + saving_your_work_warning: The save could take a while. Please do not make any further changes to the form, until the save has completed. form_rendering: help_html: Select file(s) to be offered as a download for every image in Universal Viewer, for example a PDF of the whole work (dataset). form_representative: -- GitLab From fc6f30096a51767af923715c1a9ead5bdf8f9813 Mon Sep 17 00:00:00 2001 From: "kush.varade.19" <kush.varade.19@gmail.com> Date: Mon, 30 Dec 2024 11:58:27 +0530 Subject: [PATCH 7/7] Disabled click when the save is in progress for dataset creation --- hyrax/app/assets/javascripts/work_show.js | 49 +++++++++++++---------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/hyrax/app/assets/javascripts/work_show.js b/hyrax/app/assets/javascripts/work_show.js index e69d7b08..a3b78139 100644 --- a/hyrax/app/assets/javascripts/work_show.js +++ b/hyrax/app/assets/javascripts/work_show.js @@ -28,9 +28,9 @@ $(document).on("ready", function () { if ($("#overlay").length === 0) { // Create overlay element $("body").append(` - <div id="overlay" class="overlay" style="display: flex;"> - </div> - `); + <div id="overlay" class="overlay" style="display: flex;"> + </div> + `); // Add CSS styles dynamically $("<style>") @@ -38,32 +38,39 @@ $(document).on("ready", function () { .html( ` #overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.1); - justify-content: center; - align-items: center; - z-index: 1000; - display: flex; - pointer-events: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.1); + justify-content: center; + align-items: center; + z-index: 1000; + display: flex; + pointer-events: auto; /* Allow pointer events on overlay */ + } + body.disable-clicks > *:not(#overlay) { + pointer-events: none; /* Disable pointer events on everything except the overlay */ } ` ) .appendTo("head"); } + // Disable background clicks + $("body").addClass("disable-clicks"); + // Show the overlay - $("#overlay").fadeIn(); // Show the overlay when the button is clicked + $("#overlay").fadeIn(); - // Hide the overlay when clicking on it - $("#overlay").click(function () { - $(this).fadeOut(function () { - $(this).remove(); // Remove the overlay from the DOM after fading out - }); - }); + // Hide the overlay and re-enable clicks when clicking on it + // $("#overlay").click(function () { + // $(this).fadeOut(function () { + // $(this).remove(); // Remove the overlay from the DOM after fading out + // $("body").removeClass("disable-clicks"); // Re-enable clicks on background elements + // }); + // }); }); }); -- GitLab