diff options
author | Simon Rettberg | 2019-04-03 16:16:35 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-04-03 16:16:35 +0200 |
commit | e3e9baaadc7dd890468310af820b6d1869d34c65 (patch) | |
tree | 66fca7a692682fa56ff0b8f3502b63102172d209 /modules-available/locationinfo/clientscript.js | |
parent | [locationinfo] Update translations (diff) | |
download | slx-admin-e3e9baaadc7dd890468310af820b6d1869d34c65.tar.gz slx-admin-e3e9baaadc7dd890468310af820b6d1869d34c65.tar.xz slx-admin-e3e9baaadc7dd890468310af820b6d1869d34c65.zip |
[locationinfo] Style checkboxes, use icon in save button
Diffstat (limited to 'modules-available/locationinfo/clientscript.js')
-rw-r--r-- | modules-available/locationinfo/clientscript.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules-available/locationinfo/clientscript.js b/modules-available/locationinfo/clientscript.js index f9872e02..25c255fb 100644 --- a/modules-available/locationinfo/clientscript.js +++ b/modules-available/locationinfo/clientscript.js @@ -32,6 +32,8 @@ const allDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturd * Opening times related... */ +var slxIdCounter = 0; + /** * Adds a new opening time to the table in expert mode. */ @@ -39,9 +41,16 @@ function newOpeningTime(vals) { var $row = $('#expert-template').find('div.row').clone(); if (vals['days'] && Array.isArray(vals['days'])) { for (var i = 0; i < allDays.length; ++i) { - $row.find('.i-' + allDays[i]).attr('checked', vals['days'].indexOf(allDays[i]) !== -1); + $row.find('.i-' + allDays[i]).prop('checked', vals['days'].indexOf(allDays[i]) !== -1); } } + $row.find('input').each(function() { + var $inp = $(this); + if ($inp.length === 0) return; + slxIdCounter++; + $inp.prop('id', 'id-inp-' + slxIdCounter); + $inp.siblings('label').prop('for', 'id-inp-' + slxIdCounter); + }); $row.find('.i-openingtime').val(vals['openingtime']); $row.find('.i-closingtime').val(vals['closingtime']); $('#expert-table').append($row); |