diff --git a/templates/news.html b/templates/news.html index c7155a2..65f3a55 100644 --- a/templates/news.html +++ b/templates/news.html @@ -3,7 +3,7 @@
-

News

+

News

@@ -93,41 +98,45 @@ $(document).ready(function() { {% for k, v in blockArray[count]["switches"].iteritems() %} - {% if v[2] %} - $('#s_title_{{ count }}').html("{{ v[2] }}"); + {% if v[0] %} + $('#s_title_{{ count }}').html("{{ v[0] }}"); {% endif %} - {% if v[1] == "switch" %} - $('input[id="switch_{{v[0]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { - changeSwitch(this, {{v[0]}}); + {% if v[2] == "switch" %} + $('input[id="switch_{{v[1]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { + changeSwitch(this, {{v[1]}}); }); - updateSwitches_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "pushon") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + updateSwitches_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "pushon") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'on'); + changePush({{v[1]}}, 'on'); }); - {% elif (v[1] == "pushoff") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "pushoff") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'off'); + changePush({{v[1]}}, 'off'); }); - {% elif (v[1] == "group") or (v[1] == "scene") %} - $('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "group") or (v[2] == "scene") %} + $('button[id="groupon_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - $('button[id="groupoff_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="groupoff_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'off'); + changeScene({{v[1]}}, 'off'); }); - $('button[id="scene_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="scene_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - {% elif (v[1] == "setpoint") %} - updateSetpoints_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "dimmer" or v[1] == "rgb") %} - updateDimmers_block_{{count}}.push("{{v[0]}}"); + {% elif (v[2] == "setpoint") %} + updateSetpoints_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "dimmer" or v[2] == "rgb") %} + $('#dim_{{count}}').click(function(e) { + e.preventDefault(); + changeDimmer('dim_{{v[1]}}_block_{{count}}_track', {{v[1]}}); + }); + updateDimmers_block_{{count}}.push("{{v[1]}}"); {% endif %} {% endfor %} refreshSwitches(updateSwitches_block_{{count}}, {{count}}); @@ -136,5 +145,7 @@ $(document).ready(function() { setInterval(refreshSwitches, 9000, updateSwitches_block_{{count}}, {{count}}); setInterval(dimmerSlider, 9000, updateDimmers_block_{{count}}, {{count}}); setInterval(refreshSetpoints, 9000, updateSetpoints_block_{{count}}, {{count}}); + }); + diff --git a/templates/top_tiles.html b/templates/top_tiles.html index 0e370cf..3859b22 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -5,7 +5,7 @@
{{k}} -
{{v[2]}}
+