From 0e8b138534fb5be30045d2d6e7e3852523dab59e Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Mon, 29 Aug 2016 17:42:43 +0200 Subject: [PATCH] Theming: Show loading spinner while uploading files --- apps/theming/css/settings-admin.css | 16 +++++++++------- apps/theming/js/settings-admin.js | 11 ++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/theming/css/settings-admin.css b/apps/theming/css/settings-admin.css index 4139b2f46a3..5d2b08f5e43 100644 --- a/apps/theming/css/settings-admin.css +++ b/apps/theming/css/settings-admin.css @@ -9,12 +9,13 @@ #theming .theme-undo { cursor: pointer; opacity: .5; - padding: 9px; - vertical-align: bottom; + padding: 11px 5px; + vertical-align: top; + display: inline-block; } -#theming .icon { - display: inline-block; +#theming .icon-loading-small:after { + margin: -10px 0 0 -10px; } #theming label span { @@ -23,10 +24,11 @@ padding: 8px 0px; } -#theming .icon-upload { +#theming .icon-upload, +#theming .icon-loading-small { display: inline-flex; padding: 8px; - margin: 0; + margin: 2px 0px; } div#theming_settings_msg { @@ -46,4 +48,4 @@ div#theming_settings_msg { max-width: 20%; max-height: 20%; margin-top: 20px; -} +} \ No newline at end of file diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js index c896da321c8..216463b15e0 100644 --- a/apps/theming/js/settings-admin.js +++ b/apps/theming/js/settings-admin.js @@ -25,6 +25,7 @@ function setThemingValue(setting, value) { OC.generateUrl('/apps/theming/ajax/updateStylesheet'), {'setting' : setting, 'value' : value} ).done(function(response) { OC.msg.finishedSaving('#theming_settings_msg', response); + hideUndoButton(setting, value); }).fail(function(response) { OC.msg.finishedSaving('#theming_settings_msg', response); }); @@ -114,7 +115,6 @@ function preview(setting, value) { if (setting === 'name') { window.document.title = t('core', 'Admin') + " - " + value; } - hideUndoButton(setting, value); } function hideUndoButton(setting, value) { @@ -153,12 +153,16 @@ $(document).ready(function () { done: function (e, response) { preview('logoMime', response.result.data.name); OC.msg.finishedSaving('#theming_settings_msg', response.result); + $('label#uploadlogo').addClass('icon-upload').removeClass('icon-loading-small'); + $('.theme-undo[data-setting=logoMime]').show(); }, submit: function(e, response) { OC.msg.startSaving('#theming_settings_msg'); + $('label#uploadlogo').removeClass('icon-upload').addClass('icon-loading-small'); }, fail: function (e, response){ OC.msg.finishedError('#theming_settings_msg', response._response.jqXHR.responseJSON.data.message); + $('label#uploadlogo').addClass('icon-upload').removeClass('icon-loading-small'); } }; var uploadParamsLogin = { @@ -167,11 +171,15 @@ $(document).ready(function () { done: function (e, response) { preview('backgroundMime', response.result.data.name); OC.msg.finishedSaving('#theming_settings_msg', response.result); + $('label#upload-login-background').addClass('icon-upload').removeClass('icon-loading-small'); + $('.theme-undo[data-setting=backgroundMime]').show(); }, submit: function(e, response) { OC.msg.startSaving('#theming_settings_msg'); + $('label#upload-login-background').removeClass('icon-upload').addClass('icon-loading-small'); }, fail: function (e, response){ + $('label#upload-login-background').removeClass('icon-loading-small').addClass('icon-upload'); OC.msg.finishedError('#theming_settings_msg', response._response.jqXHR.responseJSON.data.message); } }; @@ -216,6 +224,7 @@ $(document).ready(function () { $('.theme-undo').click(function (e) { var setting = $(this).data('setting'); OC.msg.startSaving('#theming_settings_msg'); + $('.theme-undo[data-setting=' + setting + ']').hide(); $.post( OC.generateUrl('/apps/theming/ajax/undoChanges'), {'setting' : setting} ).done(function(response) { -- 2.39.5