From d7455dba14a7d5152aea58a81909aae71c70edc0 Mon Sep 17 00:00:00 2001 From: Michael Jett Date: Tue, 18 Sep 2012 13:02:01 -0400 Subject: [PATCH] Dynamic Client Loading Initial Commit --- .../src/main/webapp/resources/js/app.js | 27 +++++++++++++------ .../main/webapp/resources/template/list.html | 10 ------- .../template/{client.html => templates.html} | 0 3 files changed, 19 insertions(+), 18 deletions(-) delete mode 100644 openid-connect-server/src/main/webapp/resources/template/list.html rename openid-connect-server/src/main/webapp/resources/template/{client.html => templates.html} (100%) diff --git a/openid-connect-server/src/main/webapp/resources/js/app.js b/openid-connect-server/src/main/webapp/resources/js/app.js index ece5ed7bf..4c2de9da1 100644 --- a/openid-connect-server/src/main/webapp/resources/js/app.js +++ b/openid-connect-server/src/main/webapp/resources/js/app.js @@ -559,18 +559,23 @@ initialize:function () { - this.clientList = new ClientCollection(); - - this.clientListView = new ClientListView({model:this.clientList}); - this.breadCrumbView = new BreadCrumbView({ collection:new Backbone.Collection() }); 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) { @@ -585,6 +590,8 @@ listClients:function () { + this.clientLoadCheck(); + this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.add([ {text:"Home", href:"/"}, @@ -598,6 +605,8 @@ newClient:function() { + this.clientLoadCheck(); + this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.add([ {text:"Home", href:"/"}, @@ -621,6 +630,8 @@ editClient:function(id) { + this.clientLoadCheck(); + this.breadCrumbView.collection.reset(); this.breadCrumbView.collection.add([ {text:"Home", href:"/"}, @@ -647,7 +658,8 @@ }, whiteList:function () { - $('#content').html(this.whiteListView.render().el); + + } @@ -667,8 +679,7 @@ }; // load templates and append them to the body - $.get('resources/template/client.html', _load); - $.get('resources/template/list.html', _load); + $.get('resources/template/templates.html', _load); jQuery.ajaxSetup({async:true}); app = new AppRouter(); diff --git a/openid-connect-server/src/main/webapp/resources/template/list.html b/openid-connect-server/src/main/webapp/resources/template/list.html deleted file mode 100644 index 1bcd6879a..000000000 --- a/openid-connect-server/src/main/webapp/resources/template/list.html +++ /dev/null @@ -1,10 +0,0 @@ - \ No newline at end of file diff --git a/openid-connect-server/src/main/webapp/resources/template/client.html b/openid-connect-server/src/main/webapp/resources/template/templates.html similarity index 100% rename from openid-connect-server/src/main/webapp/resources/template/client.html rename to openid-connect-server/src/main/webapp/resources/template/templates.html