diff --git a/openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag b/openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag index 724954171..a7de8fb97 100644 --- a/openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag +++ b/openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag @@ -20,8 +20,9 @@ // set up a global variable for UI components to hang extensions off of var ui = { - templates: ["resources/template/admin.html"], - routes: [] + templates: ["resources/template/admin.html"], // template files to load for UI + routes: [], // routes to add to the UI {path: URI to map to, name: unique name for internal use, callback: function to call when route is activated} + init: [] // functions to call after initialization is complete }; diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js b/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js index 493e6c880..a329c1caa 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js @@ -430,14 +430,7 @@ var AppRouter = Backbone.Router.extend({ initialize:function () { - this.clientList = new ClientCollection(); - this.whiteListList = new WhiteListCollection(); - this.blackListList = new BlackListCollection(); - this.approvedSiteList = new ApprovedSiteCollection(); - this.systemScopeList = new SystemScopeCollection(); this.clientStats = new StatsModel(); - this.accessTokensList = new AccessTokenCollection(); - this.refreshTokensList = new RefreshTokenCollection(); this.breadCrumbView = new BreadCrumbView({ collection:new Backbone.Collection() @@ -447,6 +440,12 @@ var AppRouter = Backbone.Router.extend({ this.errorHandlerView = new ErrorHandlerView(); + // call all the extra initialization functions + var app = this; + _.each(ui.init, function(fn) { + fn(app); + }); + }, notImplemented:function(){ @@ -482,8 +481,7 @@ $(function () { }; // load templates and append them to the body - $.when.apply(null, - ui.templates.map(loader) + $.when.apply(null, ui.templates.map(loader) ).done(function() { console.log('done'); $.ajaxSetup({cache:false}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js b/openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js index c031379d9..719a68517 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js @@ -209,4 +209,8 @@ ui.routes.push({path: "admin/blacklist", name: "blackList", callback: }); -ui.templates.push('resources/template/blacklist.html'); \ No newline at end of file +ui.templates.push('resources/template/blacklist.html'); + +ui.init.push(function(app) { + app.blackListList = new BlackListCollection(); +}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/client.js b/openid-connect-server-webapp/src/main/webapp/resources/js/client.js index 713e21f76..8272d59fb 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/client.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/client.js @@ -1323,4 +1323,8 @@ ui.routes.push({path: "admin/client/:id", name: "editClient", callback: } }); -ui.templates.push('resources/template/client.html'); \ No newline at end of file +ui.templates.push('resources/template/client.html'); + +ui.init.push(function(app) { + app.clientList = new ClientCollection(); +}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js b/openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js index b46983e46..e3d29ac79 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js @@ -707,4 +707,4 @@ ui.routes.push({path: "dev/dynreg/edit", name: "editDynReg", callback: } }); -ui.templates.push('resources/template/dynreg.html'); \ No newline at end of file +ui.templates.push('resources/template/dynreg.html'); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/grant.js b/openid-connect-server-webapp/src/main/webapp/resources/js/grant.js index bcf10701c..948e1c17a 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/grant.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/grant.js @@ -279,4 +279,8 @@ ui.routes.push({path: "user/approved", name: "approvedSites", callback: } }); -ui.templates.push('resources/template/grant.html'); \ No newline at end of file +ui.templates.push('resources/template/grant.html'); + +ui.init.push(function(app) { + app.approvedSiteList = new ApprovedSiteCollection(); +}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js b/openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js index 3b01bacbb..3507c65ac 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js @@ -504,4 +504,4 @@ ui.routes.push({path: "dev/resource/edit", name: "editResReg", callback: } }); -ui.templates.push('resources/template/rsreg.html'); \ No newline at end of file +ui.templates.push('resources/template/rsreg.html'); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/scope.js b/openid-connect-server-webapp/src/main/webapp/resources/js/scope.js index ea904c62e..aced6de28 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/scope.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/scope.js @@ -434,4 +434,8 @@ ui.routes.push({path: "admin/scope/:id", name: "editScope", callback: } }); -ui.templates.push('resources/template/scope.html'); \ No newline at end of file +ui.templates.push('resources/template/scope.html'); + +ui.init.push(function(app) { + app.systemScopeList = new SystemScopeCollection(); +}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/token.js b/openid-connect-server-webapp/src/main/webapp/resources/js/token.js index 4ea20b55a..ed012a620 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/token.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/token.js @@ -501,4 +501,9 @@ ui.routes.push({path: "user/tokens", name: "tokens", callback: } }); -ui.templates.push('resources/template/token.html'); \ No newline at end of file +ui.templates.push('resources/template/token.html'); + +ui.init.push(function(app) { + app.accessTokensList = new AccessTokenCollection(); + app.refreshTokensList = new RefreshTokenCollection(); +}); diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js b/openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js index d75d06e4f..8441bdebd 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js @@ -499,4 +499,8 @@ ui.routes.push({path: "admin/whitelist/:id", name: "editWhitelist", callback: }); -ui.templates.push('resources/template/whitelist.html'); \ No newline at end of file +ui.templates.push('resources/template/whitelist.html'); + +ui.init.push(function(app) { + app.whiteListList = new WhiteListCollection(); +});