hal/hal-core/resources/web/event_detail.tmpl

79 lines
No EOL
2.9 KiB
Cheetah

<h1 class="page-header">Details for <a href="?id={{event.getId()}}">{{event.getName()}}</a></h1>
<div class="col-md-5">
<div class="panel panel-default drop-shadow">
<div class="panel-heading">Configuration</div>
<div class="panel-body">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th class="text-right">Event ID:</th>
<th>{{event.getId()}}</th>
</tr>
<tr>
<th class="text-right">Name:</th>
<th>{{event.getName()}}</th>
</tr>
</thead>
<tr>
<th class="text-right">Type:</th>
<td>{{event.getDeviceConfig().getClass().getSimpleName()}}</td>
</tr>
<tr>
<th class="text-right">Owner:</th>
<td>{{event.getUser().getUsername()}} <p></td>
</tr>
<tr>
<th class="text-right">State:</th>
<td>
<form method="POST">
<input type="hidden" name="action" value="modify">
<input type="hidden" name="action_id" value="{{event.getId()}}">
<div class="btn-toolbar pull-left">
<input class="toggle-switch" type="checkbox" name="enabled"
data-on-color="danger"
{{#event.getDeviceData().getData()}}checked{{/event.getDeviceData().getData()}} >
</div>
</form>
</td>
</tr>
{{#event.getDeviceConfigurator().getConfiguration()}}
<tr>
<th class="text-right">{{.getNiceName()}}:</th>
<td>{{.getString()}}</td>
</tr>
{{/event.getDeviceConfigurator().getConfiguration()}}
</table>
</div>
</div>
</div>
<div class="col-md-7">
<div class="panel panel-default drop-shadow">
<div class="panel-heading">History data</div>
<div class="panel-body">
<table class="table table-hover table-condensed">
<thead>
<th class="col-md-6">Timestamp</th>
<th class="col-md-2">Data</th>
</thead>
{{#history}}
<tr>
<td><span class="timestamp">{{.timestamp}}</span></td>
<td>{{.data}}</td>
</tr>
{{/history}}
</table>
</div>
</div>
</div>
<script>
$(function (){
$(".toggle-switch").on("switchChange.bootstrapSwitch", function (event, state) {
$(this).closest('form').submit();
});
});
</script>