/**
* Manages the creation and retrieval of pages (route + controller)
* TODO: Convert to class/Angular service
*/
export default {
'_pages': {},
* Create a page.
* @param pageName The name of the page.
* @param templateName The file name of the template.
* @param opt_controller Controller for the page.
* @param opt_flags Additional flags passed to route provider.
* @param opt_profiles Available profiles.
'create': function (pageName, templateName, opt_controller, opt_flags, opt_profiles) {
var profiles = opt_profiles || ['old-layout', 'layout'];
for (var i = 0; i < profiles.length; ++i) {
this._pages[profiles[i] + ':' + pageName] = {
'name': pageName,
'controller': opt_controller,
'templateName': templateName,
'flags': opt_flags || {}
};
}
},
* Retrieve a registered page.
* @param profiles Available profiles to search.
'get': function (pageName, profiles) {
var current = profiles[i];
var key = current.id + ':' + pageName;
var page = this._pages[key];
if (page) {
return [current, page];
return null;