From 6badf101d72ff20aa7d03622402bc89e059d71bd Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 14 Sep 2017 18:03:39 +0200 Subject: [PATCH] Small cosmetic changes to export routine. --- app/Http/Controllers/ExportController.php | 2 +- public/js/ff/export/index.js | 18 +++++++----------- resources/views/export/index.twig | 5 +---- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 5cdd3bed06..c60452c653 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -46,7 +46,7 @@ class ExportController extends Controller $this->middleware( function ($request, $next) { View::share('mainTitleIcon', 'fa-file-archive-o'); - View::share('title', trans('firefly.export_data')); + View::share('title', trans('firefly.export_and_backup_data')); return $next($request); } diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.js index 4dd745a078..4cb60463a2 100644 --- a/public/js/ff/export/index.js +++ b/public/js/ff/export/index.js @@ -58,7 +58,8 @@ function hideForm() { function showForm() { "use strict"; $('#form-body').show(); - $('#do-export-button').show(); + $('#do-export-button').show().prop('disabled', false); + // enable button again: } function showLoading() { @@ -88,7 +89,7 @@ function callExport() { // call status, keep calling it until response is "finished"? intervalId = window.setInterval(checkStatus, 500); - $.post('export/submit', data).done(function () { + $.post('export/submit', data, null, 'json').done(function () { // stop polling: window.clearTimeout(intervalId); @@ -103,18 +104,13 @@ function callExport() { // show download showDownload(); - }).fail(function (data) { + }).fail(function (jqXHR, textStatus, errorThrown) { // show error. // show form again. - + var response = jqXHR.responseJSON; var errorText = 'The export failed. Please check the log files to find out why.'; - if (typeof data.responseJSON === 'object') { - errorText = ''; - for (var propt in data.responseJSON) { - if (data.responseJSON.hasOwnProperty(propt)) { - errorText += propt + ': ' + data.responseJSON[propt][0]; - } - } + if (typeof response === 'object') { + errorText =response.message; } showError(errorText); diff --git a/resources/views/export/index.twig b/resources/views/export/index.twig index 16df684ab0..b857b84b4d 100644 --- a/resources/views/export/index.twig +++ b/resources/views/export/index.twig @@ -5,9 +5,6 @@ {% endblock %} {% block content %} - - -
@@ -17,7 +14,7 @@
-

{{ 'export_data'|_ }}

+

{{ 'export_and_backup_data'|_ }}