modularized app router initialization functions
parent
503d6f5725
commit
f2173907ac
|
@ -20,8 +20,9 @@
|
||||||
// set up a global variable for UI components to hang extensions off of
|
// set up a global variable for UI components to hang extensions off of
|
||||||
|
|
||||||
var ui = {
|
var ui = {
|
||||||
templates: ["resources/template/admin.html"],
|
templates: ["resources/template/admin.html"], // template files to load for UI
|
||||||
routes: []
|
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>
|
</script>
|
||||||
|
|
|
@ -430,14 +430,7 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
initialize:function () {
|
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.clientStats = new StatsModel();
|
||||||
this.accessTokensList = new AccessTokenCollection();
|
|
||||||
this.refreshTokensList = new RefreshTokenCollection();
|
|
||||||
|
|
||||||
this.breadCrumbView = new BreadCrumbView({
|
this.breadCrumbView = new BreadCrumbView({
|
||||||
collection:new Backbone.Collection()
|
collection:new Backbone.Collection()
|
||||||
|
@ -447,6 +440,12 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
this.errorHandlerView = new ErrorHandlerView();
|
this.errorHandlerView = new ErrorHandlerView();
|
||||||
|
|
||||||
|
// call all the extra initialization functions
|
||||||
|
var app = this;
|
||||||
|
_.each(ui.init, function(fn) {
|
||||||
|
fn(app);
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
notImplemented:function(){
|
notImplemented:function(){
|
||||||
|
@ -482,8 +481,7 @@ $(function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
// load templates and append them to the body
|
// load templates and append them to the body
|
||||||
$.when.apply(null,
|
$.when.apply(null, ui.templates.map(loader)
|
||||||
ui.templates.map(loader)
|
|
||||||
).done(function() {
|
).done(function() {
|
||||||
console.log('done');
|
console.log('done');
|
||||||
$.ajaxSetup({cache:false});
|
$.ajaxSetup({cache:false});
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
|
@ -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…
Reference in New Issue