From 609b257e89aecf4c382146ffa2cb4f8eb1e8d168 Mon Sep 17 00:00:00 2001
From: Christian Hofmaier
Date: Tue, 26 Mar 2019 17:18:35 +0100
Subject: [locationinfo] UI rework - add Icons to Buttons - override config for
specific room - change roomplanner switch with dropdown menu - new texts for
roomplanner dropdown - when roomplanner is empty show empty green box instead
of red 0
---
.../templates/page-config-panel-default.html | 155 ++++++++++++++++++++-
1 file changed, 148 insertions(+), 7 deletions(-)
(limited to 'modules-available/locationinfo/templates/page-config-panel-default.html')
diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html
index 116c2e11..9470efbb 100644
--- a/modules-available/locationinfo/templates/page-config-panel-default.html
+++ b/modules-available/locationinfo/templates/page-config-panel-default.html
@@ -91,7 +91,7 @@
-
+
+
+
+
+
+
+
+
{{lang_cancel}}
-
{{lang_save}}
+
+
+ {{lang_save}}
+
@@ -355,11 +368,14 @@ document.addEventListener("DOMContentLoaded", function () {
var $locList = $('#location-list');
var $locInput = $('#locationids');
var $addLocDbBtn = $('#addLocDdBtn');
+ var $owPanels = $('#overrideRoomConfigs');
+ var overrides = {{{overrides}}}
// Initialize fancy tooltips
$('p.helptext').tooltip();
// Add listener to range sliders so their label can be updated
- $('input[type="range"]').change(function () {
+ var $range = $('input[type="range"]');
+ $range.change(function () {
$(this).siblings().find('.range-display').text($(this).val());
});
// Set state of input controls that aren't statically initialized server side
@@ -371,6 +387,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
+
var lids = $locInput.val().split(',');
$selLocs.empty();
for (var i = 0; i < lids.length; ++i) {
@@ -382,10 +399,11 @@ document.addEventListener("DOMContentLoaded", function () {
$('#daystoshow option[value="{{daystoshow}}"]').attr("selected", "selected");
$('#rotation option[value="{{rotation}}"]').attr("selected", "selected");
$('#mode option[value="{{mode}}"]').attr("selected", "selected");
+ $('#input-roomplanner option[value="{{roomplanner}}"]').attr("selected", "selected");
$('#daystoshow').prop('disabled', document.getElementById('scaledaysauto').checked);
- $('input[type="range"]').change();
+ $range.change();
modeChange();
// Adding/removing locations
@@ -400,8 +418,9 @@ document.addEventListener("DOMContentLoaded", function () {
});
$('#config-form').submit(function(ev) {
- if ($locInput.val().length > 0)
+ if ($locInput.val().length > 0) {
return;
+ }
ev.preventDefault();
$('#no-locations-message').modal('show');
});
@@ -418,9 +437,124 @@ document.addEventListener("DOMContentLoaded", function () {
$addLocBtnParent.removeClass('open');
}
}
+
+ // Add Panel for overwriting room specific config
+ $owPanels.find('#overrideRoom' + id).remove();
+ $owPanels.append('');
+
+
+ // Load content into panel
+ var overrideSelect = $('#override' + id);
+ overrideSelect
+ .bootstrapSwitch({size: 'small'})
+ .on('switchChange.bootstrapSwitch', function () {
+ if (this.checked) {
+ loadOverrideContent(id);
+ } else {
+ unloadOverrideContent(id);
+ }
+ });
+
+ if (overrides !== null && overrides[id] !== undefined) {
+ overrideSelect.bootstrapSwitch('state', true);
+ }
+ }
+
+ function loadOverrideContent(id) {
+ // 1. Build Content
+ // $content.append($(''));
+ var $content = $('
');
+ $content.append($('' +
+ '
{{lang_mode}}
' +
+ '
{{lang_mode1}} {{lang_mode2}} {{lang_mode3}} {{lang_mode4}}
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_useRoomplanner}}
' +
+ '
{{lang_countIp}} {{lang_countRoomplan}}
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_vertical}}
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_autoScale}}
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_daysToShow}}
' +
+ '
1 2 3 4 5 6 7
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_rotation}}
' +
+ '
{{lang_rotation0}} {{lang_rotation1}} {{lang_rotation2}} {{lang_rotation3}}
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
{{lang_scale}}
' +
+ '
%
' +
+ '
' +
+ '
'));
+
+ // 2. Load Content into Panel
+ var $panelBody = $('#overrideRoom' + id).find('div.panel-body');
+ $panelBody.append($content);
+
+ $('.modify-inputs #overrideRoom' + id + ' input[type="checkbox"]')
+ .bootstrapSwitch({size: 'small'})
+ .on('switchChange.bootstrapSwitch', function () {
+ if (this.id === 'override' + id + 'scaledaysauto') {
+ $('#override' + id + 'daystoshow').prop('disabled', this.checked);
+ }
+ });
+
+ // 3. Init parameters: Given parameters or global parameters if none given
+ var scale = $('#override' + id + 'scale');
+ if (overrides !== null && overrides[id] !== undefined) {
+ $('#override' + id + 'mode').val(overrides[id].mode);
+ $('#override' + id + 'roomplanner').val(overrides[id].roomplanner);
+ if (overrides[id].vertical) $('#override' + id + 'vertical').bootstrapSwitch('state', true);
+ if (overrides[id].scaledaysauto) $('#override' + id + 'scaledaysauto').bootstrapSwitch('state', true);
+ $('#override' + id + 'daystoshow').val(overrides[id].daystoshow);
+ $('#override' + id + 'rotation').val(overrides[id].rotation);
+ scale.val(overrides[id].scale);
+ } else {
+ $('#override' + id + 'mode').val($('#mode').val());
+ $('#override' + id + 'roomplanner').val($('#input-roomplanner').val());
+ if ($('#input-vertical').bootstrapSwitch('state')) $('#override' + id + 'vertical').bootstrapSwitch('state', true);
+ if ($('#scaledaysauto').bootstrapSwitch('state')) $('#override' + id + 'scaledaysauto').bootstrapSwitch('state', true);
+ $('#override' + id + 'daystoshow').val($('#daystoshow').val());
+ $('#override' + id + 'rotation').val($('#rotation').val());
+ scale.val($('#input-scale').val());
+ }
+
+ scale.change(function () {
+ $(this).siblings().find('.range-display').text($(this).val());
+ });
+
+ scale.change();
+ modeChangeOverride('override' + id + 'mode');
+ }
+
+ function unloadOverrideContent(id) {
+ var $panelBody = $('#overrideRoom' + id).find('div.panel-body');
+ $panelBody.find('div.list-group').remove();
+ delete overrides[id]
}
function delParent() {
+ var $id = $(this).parent().attr("data-lid");;
+ $('#overrideRoom' + $id).remove();
$(this).parent().remove();
serializeLocs();
if ($selLocs.find('li').length < 4) {
@@ -434,7 +568,6 @@ document.addEventListener("DOMContentLoaded", function () {
}).get().join(',');
$locInput.val(res);
}
-
});
/**
@@ -446,4 +579,12 @@ function modeChange() {
$('.m' + value + '-s').show();
}
+function modeChangeOverride(id) {
+ id = id.replace('override', '');
+ id = id.replace('mode', '');
+ var value = $('#override' + id + 'mode').val();
+ $('#overrideRoom' + id + ' .om' + value + '-h').hide();
+ $('#overrideRoom' + id + ' .om' + value + '-s').show();
+}
+
//-->
--
cgit v1.2.3-55-g7522