Finish developing new features

This commit is contained in:
Vitor de Miranda Henrique
2016-12-09 13:49:21 -08:00
parent f7926963ef
commit 535dd189f4
2 changed files with 14 additions and 10 deletions

View File

@@ -79,14 +79,13 @@ $(function() {
}
self.handleIO = function(data, event){
alert(data[1]);
// $.ajax({
// type: "GET",
// dataType: "json",
// data: {"io": data.pin, "status": data.value},
// url: "/plugin/enclosure/handleIO",
// async: false
// });
$.ajax({
type: "GET",
dataType: "json",
data: {"io": data[0], "status": data[1]},
url: "/plugin/enclosure/handleIO",
async: false
});
}
}

View File

@@ -34,8 +34,13 @@
</table>
<h4><p data-bind="html: settings.settings.plugins.enclosure.io1Label"></p></h4>
<button type="submit" data-bind="click: handleIO.bind($data, ['io1', 'on'])" class="btn">Turn on</button>
<button type="submit" data-bind="click: handleIO.bind($data, 'io1', 'off'), enable: settings.settings.plugins.enclosure.io1Enable && isConnected()" class="btn">Turn off</button>
<button type="submit" data-bind="click: handleIO.bind($data, ['io1', 'on']), enable: settings.settings.plugins.enclosure.io1Enable && isConnected()" class="btn">Turn on</button>
<h4><p data-bind="html: settings.settings.plugins.enclosure.io2Label"></p></h4>
<h4><p data-bind="html: settings.settings.plugins.enclosure.io3Label"></p></h4>
<h4><p data-bind="html: settings.settings.plugins.enclosure.io4Label"></p></h4>