Base white-list functionality and template

pull/105/merge
Michael Jett 2012-06-26 12:50:13 -04:00
parent 1127a7cfbc
commit b6e00b9884
4 changed files with 66 additions and 31 deletions

View File

@ -6,7 +6,7 @@
<security:authorize ifAnyGranted="ROLE_ADMIN"> <security:authorize ifAnyGranted="ROLE_ADMIN">
<li class="nav-header">Administrative</li> <li class="nav-header">Administrative</li>
<li><a href="admin/manage/#clients">Manage Clients</a></li> <li><a href="admin/manage/#clients">Manage Clients</a></li>
<li><a href="#">White Lists</a></li> <li><a href="admin/manage/#white_list">White Lists</a></li>
<li><a href="#">Black Lists</a></li> <li><a href="#">Black Lists</a></li>
</security:authorize> </security:authorize>
<li class="nav-header">Personal</li> <li class="nav-header">Personal</li>

View File

@ -235,13 +235,38 @@
} }
}); });
var URLListView = Backbone.View.extend({
tagName: 'span',
initialize:function () {
},
events:{
"click .btn-primary":"save"
},
save:function () {
},
render:function (eventName) {
// append and render
$(this.el).html($('#tmpl-url-list').html());
return this;
}
});
// Router // Router
var AppRouter = Backbone.Router.extend({ var AppRouter = Backbone.Router.extend({
routes:{ routes:{
"clients":"list", "clients":"listClients",
"client/new":"newClient", "client/new":"newClient",
"client/:id":"editClient" "client/:id":"editClient",
"white_list":"whiteList"
}, },
initialize:function () { initialize:function () {
@ -249,6 +274,9 @@
this.clientList = new ClientCollection(); this.clientList = new ClientCollection();
this.clientListView = new ClientListView({model:this.clientList}); this.clientListView = new ClientListView({model:this.clientList});
this.whiteListView = new URLListView();
this.blackListView = new URLListView();
this.startAfter([this.clientList]); this.startAfter([this.clientList]);
}, },
@ -263,7 +291,7 @@
}); });
}, },
list:function () { listClients:function () {
$('#content').html(this.clientListView.render().el); $('#content').html(this.clientListView.render().el);
this.clientListView.delegateEvents(); this.clientListView.delegateEvents();
@ -278,8 +306,13 @@
var client = this.clientList.get(id); var client = this.clientList.get(id);
this.clientFormView = new ClientFormView({model:client}); this.clientFormView = new ClientFormView({model:client});
$('#content').html(this.clientFormView.render().el); $('#content').html(this.clientFormView.render().el);
},
whiteList:function () {
$('#content').html(this.whiteListView.render().el);
} }
}); });
// holds the global app. // holds the global app.
@ -289,12 +322,18 @@
// main // main
$(function () { $(function () {
// load templates and append them to the body jQuery.ajaxSetup({async:false});
$.get('resources/template/client.html', function (templates) {
var _load = function (templates) {
$('body').append(templates); $('body').append(templates);
};
// load templates and append them to the body
$.get('resources/template/client.html', _load);
$.get('resources/template/list.html', _load);
jQuery.ajaxSetup({async:true});
app = new AppRouter(); app = new AppRouter();
});
}); });

View File

@ -89,31 +89,17 @@
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="#">Home</a> <span class="divider">/</span></li> <li><a href="#">Home</a> <span class="divider">/</span></li>
<li class="active">Manage Clients</li> <li class="active">Manage Clients</li>
</ul><div class="well"> </ul>
<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"> <div class="well">
<a class="btn btn-small btn-primary" href="#">New Client</a> <label>White list
<textarea class="span7" rows="5" id="textarea" class="input-xlarge"></textarea></label>
<span class="help-block">Enter URLs separated by a newline.</span>
<button class="btn">Submit</button>
</div> </div>
<footer> <footer>
<p>&copy; Company 2012</p> <p>&copy; Company 2012</p>
</footer></div> </footer></div>

View File

@ -0,0 +1,10 @@
<script type="text/html" id="tmpl-url-list">
<div class="well">
<label>White list
<textarea class="span7" rows="5" id="textarea" class="input-xlarge"></textarea></label>
<span class="help-block">Enter URLs separated by a newline.</span>
<button class="btn">Save</button>
</div>
</script>