This commit is contained in:
Vitor de Miranda Henrique
2016-12-09 12:49:49 -08:00
parent 1f335f6583
commit 3bdf7400a7
2 changed files with 8 additions and 5 deletions

View File

@@ -78,11 +78,11 @@ $(function() {
return "off";
}
self.handleIO = function(pin, value){
self.handleIO = function(data, event){
$.ajax({
type: "GET",
dataType: "json",
data: {"io": pin, "status": value},
data: {"io": data.pin, "status": data.value},
url: "/plugin/enclosure/handleIO",
async: false
});

View File

@@ -32,9 +32,12 @@
<th></th>
</tr>
</table>
<h4 data-bind="html: settings.settings.plugins.enclosure.io1Label "> </h4>
<button type="submit" data-bind="click: handleIO(io1,on), enable: settings.settings.plugins.enclosure.io1Enable && isConnected()" class="btn">Turn on</button>
<button type="submit" data-bind="click: handleIO(io1,off), enable: settings.settings.plugins.enclosure.io1Enable && isConnected()" class="btn">Turn off</button>
<h4 data-bind="html: io1Label "> </h4>
<button type="submit" data-bind="click: handleIO.bind($data, 'io1', 'on') , enable: settings.settings.plugins.enclosure.io1Enable && isConnected()" 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>
<h4> {{ settings.settings.plugins.enclosure.io1Label}} </h4>