From 90a1d98e068e38e1c0655d608d98d7d88f344429 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 13 May 2016 09:59:53 -0400 Subject: [PATCH] Bug 16513 - Improvements and fixes for quote upload process MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fixes some minor bugs and adds a small enhancement to the quotes editor and quotes upload pages. To test, apply the patch and go to Tools -> Quote editor - In the table of quotes, clicking the "ID" table header should trigger an alert, "Click on the quote's ide to select..." - Go to "Import quotes" and select a file to upload. - On the upload preview page you should see a new "Cancel import" button. Clicking it should return you to the quotes upload page after asking for confirmation. - Test the upload cancel button: - If you have fast reflexes or are uploading a file large enough, you should be able to see a "Cancel upload" button during the upload process. - Clicking this button should cancel the upload and return you to the quote upload page. Tested on top of Bug 16589, works as expected. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/includes/quotes-upload-toolbar.inc | 3 ++- .../prog/en/modules/tools/quotes-upload.tt | 14 +++++++++++--- .../intranet-tmpl/prog/en/modules/tools/quotes.tt | 9 ++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc index ea795cf7a6..617e3b3d53 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc @@ -1,4 +1,5 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt index cf34371e33..088b7306f5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt @@ -11,6 +11,14 @@ var oTable; //DataTable object $(document).ready(function() { + $("#cancel_upload").on("click",function(e){ + e.preventDefault(); + fnAbortRead(); + }); + $("#cancel_quotes").on("click",function(){ + return confirm( _("Are you sure you want to cancel this import?") ); + }); + // Credits: // FileReader() code copied and hacked from: // http://www.html5rocks.com/en/tutorials/file/dndfiles/ @@ -222,14 +230,14 @@ parent.location='quotes-upload.pl'; }; reader.onloadstart = function(e) { - $('#cancel_upload').css("visibility","visible"); + $('#cancel_upload').show(); $('#progress_bar').addClass("loading"); }; reader.onload = function(e) { // Ensure that the progress bar displays 100% at the end. progress.style.width = '100%'; progress.textContent = '100%'; - $('#cancel_upload').css("visibility","hidden"); + $('#cancel_upload').hide(); quotes = fnCSVToArray(e.target.result, ','); fnDataTable(quotes); } @@ -333,7 +341,7 @@ Upload quotes
- +
0%
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt index 9e80014f7d..f0d4bd841c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt @@ -8,7 +8,6 @@