Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-02-26 16:13:17 +0300
committerJulius Härtl <jus@bitgrid.net>2018-04-19 21:14:39 +0300
commitd8045966dee59d190b976dca93fddec0e77e7fd7 (patch)
treee0dc67b84ad8ddf88f5640e9de487dd39343b140 /apps/theming/js
parentd8b57924fb6d936fc674156db9ba0ef9dfe33981 (diff)
Fix undo preview and remove duplicate code
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/js')
-rw-r--r--apps/theming/js/settings-admin.js55
1 files changed, 27 insertions, 28 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index b543e0f8adb..dde7cf1bdc5 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -173,46 +173,42 @@ $(document).ready(function () {
$('#theming-name').change(function(e) {
var el = $(this);
- if(checkName()){
- $.when(el.focusout()).then(function() {
- setThemingValue('name', $(this).val());
- });
- if (e.keyCode == 13) {
- setThemingValue('name', $(this).val());
- }
- }
});
- $('#theming-url').change(function(e) {
+ $('#theming input[type=text]').change(function(e) {
var el = $(this);
- $.when(el.focusout()).then(function() {
- setThemingValue('url', $(this).val());
- });
- if (e.keyCode == 13) {
- setThemingValue('url', $(this).val());
+ var setting = el.parent().find('div[data-setting]').data('setting');
+ var value = $(this).val();
+
+ if(setting === 'color') {
+ if (value.indexOf('#') !== 0) {
+ value = '#' + value;
+ }
+ }
+ if(setting === 'name') {
+ if(checkName()){
+ $.when(el.focusout()).then(function() {
+ setThemingValue('name', value);
+ });
+ if (e.keyCode == 13) {
+ setThemingValue('name', value);
+ }
+ }
}
- });
- $('#theming-slogan').change(function(e) {
- var el = $(this);
$.when(el.focusout()).then(function() {
- setThemingValue('slogan', $(this).val());
+ setThemingValue(setting, value);
});
if (e.keyCode == 13) {
- setThemingValue('slogan', $(this).val());
+ setThemingValue(setting, value);
}
});
- $('#theming-color').change(function (e) {
- var color = $(this).val();
- if (color.indexOf('#') !== 0) {
- color = '#' + color;
- }
- setThemingValue('color', color);
- });
-
$('.theme-undo').click(function (e) {
var setting = $(this).data('setting');
+ var $form = $(this).closest('form');
+ var image = $form.data('image-key');
+
startLoading();
$('.theme-undo[data-setting=' + setting + ']').hide();
$.post(
@@ -222,10 +218,13 @@ $(document).ready(function () {
var colorPicker = document.getElementById('theming-color');
colorPicker.style.backgroundColor = response.data.value;
colorPicker.value = response.data.value.slice(1).toUpperCase();
- } else if (setting !== 'logoMime' && setting !== 'backgroundMime') {
+ } else if (!image) {
var input = document.getElementById('theming-'+setting);
input.value = response.data.value;
}
+ if (image) {
+ $form.find('.image-preview').css('background-image','none');
+ }
preview(setting, response.data.value, response.data.serverCssUrl);
});
});