Client table now fully rendered client-side with JS templates.
parent
e9954f4439
commit
4c503a7f40
|
@ -13,31 +13,7 @@
|
|||
<div class="content">
|
||||
<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/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -63,16 +63,28 @@
|
|||
|
||||
var ClientListView = Backbone.View.extend({
|
||||
|
||||
el: $("#client-table"),
|
||||
el: $(".content"),
|
||||
|
||||
initialize:function () {
|
||||
this.model.bind("reset", this.render, this);
|
||||
},
|
||||
|
||||
events:{
|
||||
"click .btn-primary":"newClient"
|
||||
},
|
||||
|
||||
newClient:function () {
|
||||
alert('new client');
|
||||
},
|
||||
|
||||
render:function (eventName) {
|
||||
|
||||
$(this.el).find(".breadcrumb").after($('#tmpl-client-table').html());
|
||||
|
||||
_.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);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
@ -112,7 +124,7 @@
|
|||
// load templates and append them to the body
|
||||
$.get('resources/template/client.html', function (templates) {
|
||||
$('body').append(templates);
|
||||
|
||||
|
||||
var app = new AppRouter();
|
||||
Backbone.history.start();
|
||||
});
|
||||
|
|
|
@ -1,44 +1,72 @@
|
|||
<script type="text/html" id="tmpl-client">
|
||||
|
||||
<td>
|
||||
<%=name%>
|
||||
</td>
|
||||
<td>
|
||||
<%=redirectURL%>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<% for (var i in grantType) { %>
|
||||
<li>
|
||||
<%=grantType[i]%>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<% for (var i in scope) { %>
|
||||
<li>
|
||||
<%=scope[i]%>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<%=authority%>
|
||||
</td>
|
||||
<td>
|
||||
<%=description%>
|
||||
</td>
|
||||
<td><input type="checkbox"
|
||||
<%=(refreshTokens == 1 ? 'checked' : '')%>
|
||||
value="" id="" name="" disabled>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-edit">edit</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-delete">delete</button>
|
||||
</td>
|
||||
<td>
|
||||
<%=name%>
|
||||
</td>
|
||||
<td>
|
||||
<%=redirectURL%>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<% for (var i in grantType) { %>
|
||||
<li>
|
||||
<%=grantType[i]%>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<% for (var i in scope) { %>
|
||||
<li>
|
||||
<%=scope[i]%>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<%=authority%>
|
||||
</td>
|
||||
<td>
|
||||
<%=description%>
|
||||
</td>
|
||||
<td><input type="checkbox"
|
||||
<%=(refreshTokens == 1 ? 'checked' : '')%>
|
||||
value="" id="" name="" disabled>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-edit">edit</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-delete">delete</button>
|
||||
</td>
|
||||
|
||||
</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