From e3e9baaadc7dd890468310af820b6d1869d34c65 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 3 Apr 2019 16:16:35 +0200 Subject: [locationinfo] Style checkboxes, use icon in save button --- modules-available/locationinfo/clientscript.js | 11 +++++++++- .../locationinfo/templates/page-locations.html | 25 +++++++++++----------- 2 files changed, 23 insertions(+), 13 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); diff --git a/modules-available/locationinfo/templates/page-locations.html b/modules-available/locationinfo/templates/page-locations.html index c79cdfe8..f90a0f35 100644 --- a/modules-available/locationinfo/templates/page-locations.html +++ b/modules-available/locationinfo/templates/page-locations.html @@ -54,7 +54,10 @@ @@ -64,17 +67,15 @@