Browse Source

modularized app router initialization functions

pull/1192/merge
Justin Richer 8 years ago
parent
commit
f2173907ac
  1. 5
      openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag
  2. 16
      openid-connect-server-webapp/src/main/webapp/resources/js/admin.js
  3. 6
      openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js
  4. 6
      openid-connect-server-webapp/src/main/webapp/resources/js/client.js
  5. 2
      openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js
  6. 6
      openid-connect-server-webapp/src/main/webapp/resources/js/grant.js
  7. 2
      openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js
  8. 6
      openid-connect-server-webapp/src/main/webapp/resources/js/scope.js
  9. 7
      openid-connect-server-webapp/src/main/webapp/resources/js/token.js
  10. 6
      openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js

5
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
};
</script>

16
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});

6
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');
ui.templates.push('resources/template/blacklist.html');
ui.init.push(function(app) {
app.blackListList = new BlackListCollection();
});

6
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');
ui.templates.push('resources/template/client.html');
ui.init.push(function(app) {
app.clientList = new ClientCollection();
});

2
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');
ui.templates.push('resources/template/dynreg.html');

6
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');
ui.templates.push('resources/template/grant.html');
ui.init.push(function(app) {
app.approvedSiteList = new ApprovedSiteCollection();
});

2
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');
ui.templates.push('resources/template/rsreg.html');

6
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');
ui.templates.push('resources/template/scope.html');
ui.init.push(function(app) {
app.systemScopeList = new SystemScopeCollection();
});

7
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');
ui.templates.push('resources/template/token.html');
ui.init.push(function(app) {
app.accessTokensList = new AccessTokenCollection();
app.refreshTokensList = new RefreshTokenCollection();
});

6
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');
ui.templates.push('resources/template/whitelist.html');
ui.init.push(function(app) {
app.whiteListList = new WhiteListCollection();
});

Loading…
Cancel
Save