Dynamic Client Loading Initial Commit

pull/210/head
Michael Jett 12 years ago
parent 2a0602863e
commit d7455dba14

@ -559,18 +559,23 @@
initialize:function () { initialize:function () {
this.clientList = new ClientCollection();
this.clientListView = new ClientListView({model:this.clientList});
this.breadCrumbView = new BreadCrumbView({ this.breadCrumbView = new BreadCrumbView({
collection:new Backbone.Collection() collection:new Backbone.Collection()
}); });
this.breadCrumbView.render(); this.breadCrumbView.render();
this.startAfter([this.clientList]); //this.startAfter([this.clientList]);
Backbone.history.start();
},
clientLoadCheck: function() {
// check to see if the client collections are already loaded
// if they aren't then load them
if (!this.clientList || !this.clientListView) {
this.clientList = new ClientCollection();
this.clientListView = new ClientListView({model:this.clientList});
}
}, },
startAfter:function (collections) { startAfter:function (collections) {
@ -585,6 +590,8 @@
listClients:function () { listClients:function () {
this.clientLoadCheck();
this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([ this.breadCrumbView.collection.add([
{text:"Home", href:"/"}, {text:"Home", href:"/"},
@ -598,6 +605,8 @@
newClient:function() { newClient:function() {
this.clientLoadCheck();
this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([ this.breadCrumbView.collection.add([
{text:"Home", href:"/"}, {text:"Home", href:"/"},
@ -621,6 +630,8 @@
editClient:function(id) { editClient:function(id) {
this.clientLoadCheck();
this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([ this.breadCrumbView.collection.add([
{text:"Home", href:"/"}, {text:"Home", href:"/"},
@ -647,7 +658,8 @@
}, },
whiteList:function () { whiteList:function () {
$('#content').html(this.whiteListView.render().el);
} }
@ -667,8 +679,7 @@
}; };
// load templates and append them to the body // load templates and append them to the body
$.get('resources/template/client.html', _load); $.get('resources/template/templates.html', _load);
$.get('resources/template/list.html', _load);
jQuery.ajaxSetup({async:true}); jQuery.ajaxSetup({async:true});
app = new AppRouter(); app = new AppRouter();

@ -1,10 +0,0 @@
<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>
Loading…
Cancel
Save