diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-08-04 14:41:44 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-08-10 12:37:58 +0200 |
commit | b16ce1b4babd9cd59d5797eafe31f4c96fb8149b (patch) | |
tree | fb9ea25caa383c2211a2561dd1003682c1f77e9e /apps/theming/js/settings-admin.js | |
parent | 5999b212d1110a56f2c1f99820a9053d184b9a0c (diff) | |
download | nextcloud-server-b16ce1b4babd9cd59d5797eafe31f4c96fb8149b.tar.gz nextcloud-server-b16ce1b4babd9cd59d5797eafe31f4c96fb8149b.zip |
Fix preview of theming
Pull request #5429 made cached SCSS files depend on a hash of the base
URL, so the "/css/core/server.css" file does no longer exist; as the
file can not be loaded the "Loading preview" message is never removed
and the "Saved" message is never shown.
As it now depends on the hash of the base URL the file to be reloaded
can no longer be hardcoded, so the full URL to the "server.css" file
that has to be reloaded (if any) is now got from the DataResponse
provided by the controller.
Fixes #5975
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/theming/js/settings-admin.js')
-rw-r--r-- | apps/theming/js/settings-admin.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js index 9d8e706e124..d9e66284d14 100644 --- a/apps/theming/js/settings-admin.js +++ b/apps/theming/js/settings-admin.js @@ -30,7 +30,7 @@ function setThemingValue(setting, value) { OC.generateUrl('/apps/theming/ajax/updateStylesheet'), {'setting' : setting, 'value' : value} ).done(function(response) { hideUndoButton(setting, value); - preview(setting, value); + preview(setting, value, response.data.serverCssUrl); }).fail(function(response) { OC.msg.finishedSaving('#theming_settings_msg', response); $('#theming_settings_loading').hide(); @@ -38,9 +38,9 @@ function setThemingValue(setting, value) { } -function preview(setting, value) { +function preview(setting, value, serverCssUrl) { OC.msg.startAction('#theming_settings_msg', t('theming', 'Loading preview…')); - var stylesheetsLoaded = 2; + var stylesheetsLoaded = 1; var reloadStylesheets = function(cssFile) { var queryString = '?reload=' + new Date().getTime(); var url = cssFile + queryString; @@ -62,7 +62,11 @@ function preview(setting, value) { stylesheet.appendTo("head"); }; - reloadStylesheets(OC.generateUrl('/css/core/server.css')); + if (serverCssUrl !== undefined) { + stylesheetsLoaded++; + + reloadStylesheets(serverCssUrl); + } reloadStylesheets(OC.generateUrl('/apps/theming/styles')); // Preview images @@ -218,7 +222,7 @@ $(document).ready(function () { var input = document.getElementById('theming-'+setting); input.value = response.data.value; } - preview(setting, response.data.value); + preview(setting, response.data.value, response.data.serverCssUrl); }); }); |