Client table now fully rendered client-side with JS templates.
parent
e9954f4439
commit
4c503a7f40
|
@ -13,31 +13,7 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<o:breadcrumbs crumb="Manage Clients"/>
|
<o:breadcrumbs crumb="Manage Clients"/>
|
||||||
|
|
||||||
<div class="well">
|
|
||||||
<a class="btn btn-small btn-primary" href="#">New Client</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="client-table" class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Redirect URL</th>
|
|
||||||
<th>Grant Types</th>
|
|
||||||
<th>Scope</th>
|
|
||||||
<th>Authority</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Refresh Tokens</th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="well">
|
|
||||||
<a class="btn btn-small btn-primary" href="#">New Client</a>
|
|
||||||
</div>
|
|
||||||
<o:copyright/>
|
<o:copyright/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -63,16 +63,28 @@
|
||||||
|
|
||||||
var ClientListView = Backbone.View.extend({
|
var ClientListView = Backbone.View.extend({
|
||||||
|
|
||||||
el: $("#client-table"),
|
el: $(".content"),
|
||||||
|
|
||||||
initialize:function () {
|
initialize:function () {
|
||||||
this.model.bind("reset", this.render, this);
|
this.model.bind("reset", this.render, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
events:{
|
||||||
|
"click .btn-primary":"newClient"
|
||||||
|
},
|
||||||
|
|
||||||
|
newClient:function () {
|
||||||
|
alert('new client');
|
||||||
|
},
|
||||||
|
|
||||||
render:function (eventName) {
|
render:function (eventName) {
|
||||||
|
|
||||||
|
$(this.el).find(".breadcrumb").after($('#tmpl-client-table').html());
|
||||||
|
|
||||||
_.each(this.model.models, function (client) {
|
_.each(this.model.models, function (client) {
|
||||||
$(this.el).append(new ClientView({model:client}).render().el);
|
$("#client-table").append(new ClientView({model:client}).render().el);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,3 +42,31 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" id="tmpl-client-table">
|
||||||
|
<div class="well">
|
||||||
|
<a class="btn btn-small btn-primary" href="#">New Client</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table id="client-table" class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Redirect URL</th>
|
||||||
|
<th>Grant Types</th>
|
||||||
|
<th>Scope</th>
|
||||||
|
<th>Authority</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Refresh Tokens</th>
|
||||||
|
<th class="span1"></th>
|
||||||
|
<th class="span1"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="well">
|
||||||
|
<a class="btn btn-small btn-primary" href="#">New Client</a>
|
||||||
|
</div>
|
||||||
|
</script>
|
Loading…
Reference in New Issue