diff options
author | Simon Rettberg | 2016-09-07 15:35:34 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-09-07 15:35:34 +0200 |
commit | 73e3c24c042ac29316a5b0bff60ec73b97572ced (patch) | |
tree | 09b9c8490ad9f076f26d13f2b11186d813d78f9e /modules-available/roomplanner/js | |
parent | [roomplanner] Location name in h1 (diff) | |
download | slx-admin-73e3c24c042ac29316a5b0bff60ec73b97572ced.tar.gz slx-admin-73e3c24c042ac29316a5b0bff60ec73b97572ced.tar.xz slx-admin-73e3c24c042ac29316a5b0bff60ec73b97572ced.zip |
[roomplanner] Sanity checks/fixups when saving computers, more user feedback, smaller grid
Diffstat (limited to 'modules-available/roomplanner/js')
-rw-r--r-- | modules-available/roomplanner/js/grid.js | 6 | ||||
-rw-r--r-- | modules-available/roomplanner/js/init.js | 15 |
2 files changed, 15 insertions, 6 deletions
diff --git a/modules-available/roomplanner/js/grid.js b/modules-available/roomplanner/js/grid.js index 2ba1c7a1..2cca26cd 100644 --- a/modules-available/roomplanner/js/grid.js +++ b/modules-available/roomplanner/js/grid.js @@ -19,8 +19,8 @@ if (!roomplanner) var roomplanner = { cellsep: 4, scale: 100, room: { - width: 1000, - height: 1000 + width: 33, + height: 33 } }, selectFromServer: selectMachine, @@ -412,7 +412,7 @@ $(document).ready(function(){ roomplanner.slider = $('#scaleslider').slider({ orientation: "horizontal", range: "min", - min: 50, + min: 40, max: 150, value: 100, change: update, diff --git a/modules-available/roomplanner/js/init.js b/modules-available/roomplanner/js/init.js index 2ff45cee..67090cc2 100644 --- a/modules-available/roomplanner/js/init.js +++ b/modules-available/roomplanner/js/init.js @@ -2,8 +2,6 @@ function initRoomplanner() { - console.log('initRoomplanner'); - $('#drawarea').css('top',(-roomplanner.settings.scale*10)+'px'); $('#drawarea').css('left',(-roomplanner.settings.scale*10)+'px'); @@ -23,16 +21,27 @@ function initRoomplanner() { }); $("#saveBtn").click(function() { + $('#saveBtn').prop('disabled', true); + $('#error-msg').hide(); + $('#success-msg').hide(); + $('#saving-msg').show(); + var serializedCurrent = roomplanner.serialize(); $.post('?do=roomplanner&locationid=' + locationId, - { token: TOKEN, action: 'save', serializedRoom: roomplanner.serialize() } + { token: TOKEN, action: 'save', serializedRoom: serializedCurrent } ).done(function ( data ) { if (data.indexOf('SUCCESS') !== -1) { window.close(); + // If window.close() failed, we give some feedback and remember the state as saved + $('#success-msg').show(); + plannerLoadState = serializedCurrent; return; } $('#error-msg').text('Error: ' + data).show(); }).fail(function () { $('#error-msg').text('AJAX save call failed').show(); + }).always(function() { + $('#saveBtn').prop('disabled', false); + $('#saving-msg').hide(); }); }); |