summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorSimon Rettberg2020-12-16 16:03:19 +0100
committerSimon Rettberg2020-12-16 16:03:19 +0100
commitab07571f86986dadb5ab824444128619078e702c (patch)
tree56f1441047de971dad61d9856cd4b42e36e23a7e /modules-available/locations
parent[locations] openingtimes: fix switch to expert mode (diff)
downloadslx-admin-ab07571f86986dadb5ab824444128619078e702c.tar.gz
slx-admin-ab07571f86986dadb5ab824444128619078e702c.tar.xz
slx-admin-ab07571f86986dadb5ab824444128619078e702c.zip
[locations] Fix adding expert rows; tweak WOL/SD style some more
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/clientscript.js8
-rw-r--r--modules-available/locations/templates/ajax-opening-location.html28
2 files changed, 22 insertions, 14 deletions
diff --git a/modules-available/locations/clientscript.js b/modules-available/locations/clientscript.js
index 89abcefc..9a434e04 100644
--- a/modules-available/locations/clientscript.js
+++ b/modules-available/locations/clientscript.js
@@ -37,8 +37,8 @@ var slxIdCounter = 0;
/**
* Adds a new opening time to the table in expert mode.
*/
-function newOpeningTime(vals) {
- var $row = $('#expert-template').find('div.row').clone();
+function newOpeningTime($loc, vals) {
+ var $row = $loc.find('.expert-template div.row').clone();
if (vals['days'] && Array.isArray(vals['days'])) {
for (var i = 0; i < allDays.length; ++i) {
$row.find('.i-' + allDays[i]).prop('checked', vals['days'].indexOf(allDays[i]) !== -1);
@@ -53,7 +53,7 @@ function newOpeningTime(vals) {
});
$row.find('.i-openingtime').val(vals['openingtime']);
$row.find('.i-closingtime').val(vals['closingtime']);
- $('#expert-table').append($row);
+ $loc.find('.expert-table').append($row);
return $row;
}
@@ -158,4 +158,4 @@ function validateOpeningTimes(event) {
event.preventDefault();
}
$form.find('input[name="openingtimes"]').val(JSON.stringify(schedule));
-} \ No newline at end of file
+}
diff --git a/modules-available/locations/templates/ajax-opening-location.html b/modules-available/locations/templates/ajax-opening-location.html
index 9d4e6f98..c3a32fd1 100644
--- a/modules-available/locations/templates/ajax-opening-location.html
+++ b/modules-available/locations/templates/ajax-opening-location.html
@@ -95,7 +95,7 @@
</div>
</div>
-<div class="hidden" class="expert-template">
+<div class="hidden expert-template">
<div class="row expert-row">
<hr>
<div class="col-xs-12 days-box">
@@ -133,9 +133,13 @@
</div>
</div>
<div class="col-sm-8">
- <input disabled type="number" id="wol-offset-{{id}}" name="wol-offset"
- value="{{wol-options.wol-offset}}" placeholder="0" min="0" max="15">
- <label for="wol-offset-{{id}}">{{lang_offsetEarly}}</label>
+ <div class="input-group">
+ <input disabled type="number" id="wol-offset-{{id}}" name="wol-offset" class="form-control"
+ value="{{wol-options.wol-offset}}" placeholder="0" min="0" max="15">
+ <span class="input-group-addon slx-ga2">
+ <label for="wol-offset-{{id}}">{{lang_offsetEarly}}</label>
+ </span>
+ </div>
</div>
</div>
<div class="row shutdown">
@@ -146,9 +150,13 @@
</div>
</div>
<div class="col-sm-8">
- <input disabled type="number" id="sd-offset-{{id}}" name="sd-offset"
- value="{{sd-options.sd-offset}}" placeholder="0" min="0" max="15">
- <label for="sd-offset-{{id}}">{{lang_offsetLate}}</label>
+ <div class="input-group">
+ <input disabled type="number" id="sd-offset-{{id}}" name="sd-offset" class="form-control"
+ value="{{sd-options.sd-offset}}" placeholder="0" min="0" max="15">
+ <span class="input-group-addon slx-ga2">
+ <label for="sd-offset-{{id}}">{{lang_offsetLate}}</label>
+ </span>
+ </div>
</div>
</div>
{{/rebootcontrol}}
@@ -173,7 +181,7 @@
{{#expertMode}}
for (var i = 0; i < scheduleData.length; ++i) {
- newOpeningTime(scheduleData[i]);
+ newOpeningTime($loc, scheduleData[i]);
}
{{/expertMode}}
{{^expertMode}}
@@ -195,14 +203,14 @@
$loc.find('.new-openingtime').click(function (e) {
e.preventDefault();
- setTimepicker(newOpeningTime({}).find('.timepicker2'));
+ setTimepicker(newOpeningTime($loc, {}).find('.timepicker2'));
});
$loc.find('.btn-show-expert').click(function (e) {
e.preventDefault();
scheduleData = simpleToExpert($loc);
for (var i = 0; i < scheduleData.length; ++i) {
- setTimepicker(newOpeningTime(scheduleData[i]).find('.timepicker2'));
+ setTimepicker(newOpeningTime($loc, scheduleData[i]).find('.timepicker2'));
}
$loc.find('.simple-mode').remove();
$loc.find('.expert-mode').show();