Browse Source

webui: always initialize checkbox with the unique id

even when the cfg object does not list it, like with scheduler button
trying to fix #2459
pull/2471/head
Maxim Prokhorov 2 years ago
parent
commit
526a5dd239
21 changed files with 10905 additions and 10914 deletions
  1. BIN
      code/espurna/data/index.all.html.gz
  2. BIN
      code/espurna/data/index.curtain.html.gz
  3. BIN
      code/espurna/data/index.garland.html.gz
  4. BIN
      code/espurna/data/index.light.html.gz
  5. BIN
      code/espurna/data/index.lightfox.html.gz
  6. BIN
      code/espurna/data/index.rfbridge.html.gz
  7. BIN
      code/espurna/data/index.rfm69.html.gz
  8. BIN
      code/espurna/data/index.sensor.html.gz
  9. BIN
      code/espurna/data/index.small.html.gz
  10. BIN
      code/espurna/data/index.thermostat.html.gz
  11. +831
    -831
      code/espurna/static/index.all.html.gz.h
  12. +933
    -934
      code/espurna/static/index.curtain.html.gz.h
  13. +928
    -928
      code/espurna/static/index.garland.html.gz.h
  14. +1482
    -1482
      code/espurna/static/index.light.html.gz.h
  15. +930
    -930
      code/espurna/static/index.lightfox.html.gz.h
  16. +965
    -965
      code/espurna/static/index.rfbridge.html.gz.h
  17. +1991
    -1991
      code/espurna/static/index.rfm69.html.gz.h
  18. +992
    -992
      code/espurna/static/index.sensor.html.gz.h
  19. +891
    -892
      code/espurna/static/index.small.html.gz.h
  20. +947
    -947
      code/espurna/static/index.thermostat.html.gz.h
  21. +15
    -22
      code/html/custom.js

BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.curtain.html.gz View File


BIN
code/espurna/data/index.garland.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.lightfox.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


BIN
code/espurna/data/index.thermostat.html.gz View File


+ 831
- 831
code/espurna/static/index.all.html.gz.h
File diff suppressed because it is too large
View File


+ 933
- 934
code/espurna/static/index.curtain.html.gz.h
File diff suppressed because it is too large
View File


+ 928
- 928
code/espurna/static/index.garland.html.gz.h
File diff suppressed because it is too large
View File


+ 1482
- 1482
code/espurna/static/index.light.html.gz.h
File diff suppressed because it is too large
View File


+ 930
- 930
code/espurna/static/index.lightfox.html.gz.h
File diff suppressed because it is too large
View File


+ 965
- 965
code/espurna/static/index.rfbridge.html.gz.h
File diff suppressed because it is too large
View File


+ 1991
- 1991
code/espurna/static/index.rfm69.html.gz.h
File diff suppressed because it is too large
View File


+ 992
- 992
code/espurna/static/index.sensor.html.gz.h
File diff suppressed because it is too large
View File


+ 891
- 892
code/espurna/static/index.small.html.gz.h
File diff suppressed because it is too large
View File


+ 947
- 947
code/espurna/static/index.thermostat.html.gz.h
File diff suppressed because it is too large
View File


+ 15
- 22
code/html/custom.js View File

@ -449,32 +449,25 @@ function initSelectGPIO(select) {
}
function fillTemplateLineFromCfg(line, id, cfg) {
for (var [key, value] of Object.entries(cfg)) {
var span = $(`span.${key}`, line);
if (span.length) {
span.html(cfg[key]);
continue;
}
var input = $(`input[name='${key}']`, line);
if (input.length) {
if (input.is("[type='checkbox']")) {
var realId = key + id;
input.prop("checked", cfg[key])
.attr("id", realId)
.next().attr("for", realId);
} else {
input.val(cfg[key]);
$("input,select,span", line).each(function(_, elem) {
if (elem.name in cfg) {
switch (elem.tagName) {
case "INPUT":
case "SELECT":
elem.value = cfg[elem.name];
break;
case "SPAN":
elem.textContent = cfg[elem.name];
break;
}
continue;
}
var select = $(`select[name='${key}']`, line);
if (select.length) {
select.prop("value", cfg[key]);
continue;
if (elem.tagName === "INPUT" && elem.type === "checkbox") {
const realId = elem.name.concat(id);
elem.id = realId;
elem.nextElementSibling.htmlFor = realId;
}
}
});
setOriginalsFromValues($("input,select", line));
}


Loading…
Cancel
Save