2015-07-27 15:10:11 +00:00
|
|
|
<div class="col-md-12">
|
2015-08-04 12:59:24 +00:00
|
|
|
<div class="panel panel-default">
|
2016-07-28 23:30:03 +02:00
|
|
|
<div class="panel-heading">{{name}}</div>
|
2015-07-27 15:10:11 +00:00
|
|
|
<div class="panel-body">
|
2016-07-28 23:30:03 +02:00
|
|
|
<table class="table table-hover table-condensed">
|
2015-07-27 15:10:11 +00:00
|
|
|
<thead><tr>
|
2016-07-28 23:30:03 +02:00
|
|
|
{{#params}}
|
|
|
|
|
<th>{{.getNiceName()}}</th>
|
|
|
|
|
{{/params}}
|
|
|
|
|
<th>
|
2016-08-05 16:44:43 +02:00
|
|
|
<button type="button" class="btn btn-default pull-left" data-toggle="modal" data-target="#configureModal" title="Create">+</button>
|
2016-07-28 23:30:03 +02:00
|
|
|
</th>
|
2015-07-27 15:10:11 +00:00
|
|
|
</tr></thead>
|
2015-08-07 14:46:01 +00:00
|
|
|
{{#data}}
|
2015-09-26 21:19:24 +00:00
|
|
|
<tr {{#.disabled}}class="active"{{/.disabled}}>
|
|
|
|
|
{{#.getConfiguration()}}
|
2015-08-07 14:46:01 +00:00
|
|
|
<td>
|
|
|
|
|
{{#.isTypeBoolean()}}
|
2015-09-26 21:19:24 +00:00
|
|
|
<input type="checkbox" {{#.getBoolean()}}checked{{/.getBoolean()}} disabled />
|
2015-08-07 14:46:01 +00:00
|
|
|
{{/.isTypeBoolean()}}
|
2015-09-26 21:19:24 +00:00
|
|
|
{{^.isTypeBoolean()}}{{.getString()}}{{/.isTypeBoolean()}}
|
2015-08-07 14:46:01 +00:00
|
|
|
</td>
|
2015-09-26 21:19:24 +00:00
|
|
|
{{/.getConfiguration()}}
|
2016-08-05 16:44:43 +02:00
|
|
|
<td>
|
|
|
|
|
<div class="btn-toolbar pull-right">
|
|
|
|
|
<button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#configureModal" title="Edit"
|
|
|
|
|
data-id="{{.getId()}}" {{#.getConfiguration()}}data-{{.getName()}}="{{.getString()}}" {{/.getConfiguration()}}>
|
|
|
|
|
<span class="glyphicon glyphicon-pencil"></span>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<form method="POST">
|
|
|
|
|
<input type="hidden" name="action" value="delete">
|
|
|
|
|
<input type="hidden" name="id" value="{{.getId()}}">
|
|
|
|
|
<button type="submit" class="btn btn-danger btn-xs" title="Delete">>
|
|
|
|
|
<span class="glyphicon glyphicon-trash"></span>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
2015-11-16 17:48:37 +01:00
|
|
|
<button type="button" class="btn btn-default btn-xs" title="Edit">
|
2015-09-26 21:19:24 +00:00
|
|
|
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
|
|
|
|
|
</button>
|
2015-11-16 17:48:37 +01:00
|
|
|
<button type="button" class="btn btn-default btn-xs" title="Remove">
|
2015-09-26 21:19:24 +00:00
|
|
|
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
|
|
|
|
</button>
|
2015-08-04 12:59:24 +00:00
|
|
|
</td>
|
2015-07-27 15:10:11 +00:00
|
|
|
</tr>
|
2015-08-07 14:46:01 +00:00
|
|
|
{{/data}}
|
2015-07-27 15:10:11 +00:00
|
|
|
</table>
|
|
|
|
|
</div>
|
2015-09-26 21:19:24 +00:00
|
|
|
<div class="panel-footer clearfix">
|
|
|
|
|
<button type="button" class="btn btn-primary pull-right">Apply Configuration</button>
|
2015-08-04 12:59:24 +00:00
|
|
|
</div>
|
2015-07-27 15:10:11 +00:00
|
|
|
</div>
|
2015-09-24 14:47:51 +00:00
|
|
|
</div>
|
|
|
|
|
|
2016-08-05 16:44:43 +02:00
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(function(){
|
|
|
|
|
$("#configureModal").on('show.bs.modal', function (event) {
|
|
|
|
|
var button = $(event.relatedTarget);
|
|
|
|
|
var modal = $(this);
|
|
|
|
|
modal.find("input[type=text]").val(""); // Reset all inputs
|
|
|
|
|
if(button.data("id") >= 0){ // edit
|
|
|
|
|
modal.find("input[name=action]").val("modify");
|
|
|
|
|
modal.find("input[name=id]").val(button.data("id"));
|
|
|
|
|
|
|
|
|
|
// Fill in inputs
|
|
|
|
|
$.each(button.attr(), function(fieldName, value) {
|
|
|
|
|
if(fieldName.startsWith("data-")) {
|
|
|
|
|
fieldName = fieldName.substring(5);
|
|
|
|
|
modal.find("input").filter(function() { // case insensitive search
|
|
|
|
|
return this.name.toLowerCase() == fieldName;
|
|
|
|
|
}).val(value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else{ // create
|
|
|
|
|
modal.find("input[name=action]").val("create");
|
|
|
|
|
modal.find("input[name=id]").val(-1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2015-09-24 14:47:51 +00:00
|
|
|
<!-- Modal -->
|
|
|
|
|
<div class="modal fade" id="configureModal" tabindex="-1" role="dialog" aria-labelledby="configureModalLabel">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
|
<h4 class="modal-title" id="configureModalLabel">Configure</h4>
|
|
|
|
|
</div>
|
2016-08-02 17:52:47 +02:00
|
|
|
<form class="form-horizontal">
|
|
|
|
|
<div class="modal-body">
|
2016-08-05 16:44:43 +02:00
|
|
|
<input type="hidden" name="action">
|
|
|
|
|
<input type="hidden" name="id">
|
2015-09-26 21:19:24 +00:00
|
|
|
{{#params}}
|
2015-09-24 14:47:51 +00:00
|
|
|
<div class="form-group">
|
2015-09-26 21:19:24 +00:00
|
|
|
<label for="{{.getName()}}" class="control-label col-xs-2">{{.getNiceName()}}</label>
|
2015-09-24 14:47:51 +00:00
|
|
|
<div class="col-xs-10">
|
2015-09-26 21:19:24 +00:00
|
|
|
{{#.isTypeString()}}
|
2016-08-02 17:52:47 +02:00
|
|
|
<input type="text" class="form-control" id="{{.getName()}}" placeholder="{{.getNiceName()}}">
|
2015-09-26 21:19:24 +00:00
|
|
|
{{/.isTypeString()}}
|
|
|
|
|
{{#.isTypeInt()}}
|
|
|
|
|
<input type="number" class="form-control" id="{{.getName()}}">
|
|
|
|
|
{{/.isTypeInt()}}
|
|
|
|
|
{{#.isTypeBoolean()}}
|
|
|
|
|
<input type="checkbox" class="form-control" id="{{.getName()}}">
|
|
|
|
|
{{/.isTypeBoolean()}}
|
2015-09-24 14:47:51 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-09-26 21:19:24 +00:00
|
|
|
{{/params}}
|
2016-08-02 17:52:47 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
|
|
|
<button type="submit" class="btn btn-success">Save</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2015-09-24 14:47:51 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-27 15:10:11 +00:00
|
|
|
</div>
|