diff --git a/static/juice.js b/static/juice.js index 9bcb6cc..fdcfbd4 100644 --- a/static/juice.js +++ b/static/juice.js @@ -5,8 +5,8 @@ function load() { Object.entries(init_state).forEach(([device_id, sub_devs]) => { let device = document.querySelector('#' + device_id); - Object.entries(sub_devs).forEach(([sub_dev_id, state]) => { - let sub_dev = device.querySelector('.' + sub_dev_id); + Object.entries(sub_devs).forEach(([sub_device_id, state]) => { + let sub_dev = device.querySelector('.' + sub_device_id); let svg = sub_dev.querySelector('object').getSVGDocument().firstElementChild; if (state) { svg.classList.remove('off'); @@ -175,7 +175,7 @@ function toggle_outlet(svg) { function save_field(field) { let value = field.firstElementChild.value; let device_id = field.parentElement.id; - let sub_dev_id; + let sub_device_id; if (field.parentElement.className.includes('sub_device')) { sub_device_id = field.parentElement.children[0].textContent; device_id = field.parentElement.parentElement.parentElement.id; @@ -184,7 +184,7 @@ function save_field(field) { } let data = { device_id: device_id, - sub_dev_id: sub_dev_id, + sub_device_id: sub_device_id, field: field.classList[0], value: value }; diff --git a/templates/index.html b/templates/index.html index 2d058e6..fe7e8ef 100644 --- a/templates/index.html +++ b/templates/index.html @@ -38,11 +38,11 @@
{{ device.ip_address }}{% if not device.locked %}{% endif %}
{% if device.type == 'RelayDevice' %} - {% for sub_dev in device.sub_devices %} -
-
{{ sub_dev.id }}
+ {% for sub_device in device.sub_devices %} +
+
{{ sub_device.id }}
-
{{ sub_dev.description }}{% if not device.locked %}{% endif %}
+
{{ sub_device.description }}{% if not device.locked %}{% endif %}
{% endfor %} {% elif device.type == 'LightStrip' %}