diff options
author | Julius Haertl <jus@bitgrid.net> | 2016-10-12 16:45:07 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-05-08 10:16:29 +0200 |
commit | 4199a569127699cc893416bf47ece5a8d28a18a3 (patch) | |
tree | 1a31e0b2d6e753fcda28a4038ce2b3ae7d9f5c5a /apps/theming/js/settings-admin.js | |
parent | 4d7a96bc85b9a114daf9fb027a483daf26905b25 (diff) | |
download | nextcloud-server-4199a569127699cc893416bf47ece5a8d28a18a3.tar.gz nextcloud-server-4199a569127699cc893416bf47ece5a8d28a18a3.zip |
Theming app: Add plain background color option
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/js/settings-admin.js')
-rw-r--r-- | apps/theming/js/settings-admin.js | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js index 802f6e05c07..5d91892c007 100644 --- a/apps/theming/js/settings-admin.js +++ b/apps/theming/js/settings-admin.js @@ -35,6 +35,7 @@ function setThemingValue(setting, value) { OC.msg.finishedSaving('#theming_settings_msg', response); $('#theming_settings_loading').hide(); }); + } function preview(setting, value) { @@ -74,18 +75,13 @@ function preview(setting, value) { previewImageLogo.src = OC.getRootPath() + '/core/img/logo-icon.svg?v' + timestamp; } } - if (setting === 'backgroundMime') { - var previewImage = document.getElementById('theming-preview'); - if (value !== '') { - previewImage.style.backgroundImage = "url('" + OC.generateUrl('/apps/theming/loginbackground') + "?v" + timestamp + "')"; - } else { - previewImage.style.backgroundImage = "url('" + OC.getRootPath() + '/core/img/background.jpg?v' + timestamp + "')"; - } - } if (setting === 'name') { window.document.title = t('core', 'Admin') + " - " + value; } + + hideUndoButton(setting, value); + } function hideUndoButton(setting, value) { @@ -103,6 +99,14 @@ function hideUndoButton(setting, value) { } else { $('.theme-undo[data-setting=' + setting + ']').show(); } + + if(setting === 'backgroundMime' && value !== 'backgroundColor') { + $('.theme-remove-bg').show(); + } + if(setting === 'backgroundMime' && value === 'backgroundColor') { + $('.theme-remove-bg').hide(); + $('.theme-undo[data-setting=backgroundMime]').show(); + } } $(document).ready(function () { @@ -116,6 +120,7 @@ $(document).ready(function () { } hideUndoButton(setting, value); }); + var uploadParamsLogo = { pasteZone: null, dropZone: null, @@ -208,4 +213,16 @@ $(document).ready(function () { preview(setting, response.data.value); }); }); + + $('.theme-remove-bg').click(function() { + startLoading(); + $.post( + OC.generateUrl('/apps/theming/ajax/updateLogo'), {'backgroundColor' : true} + ).done(function(response) { + preview('backgroundMime', 'backgroundColor'); + }).fail(function(response) { + OC.msg.finishedSaving('#theming_settings_msg', response); + }); + }); + }); |