kopia lustrzana https://github.com/c9/core
Fix login / error handling
rodzic
59ad896919
commit
37286ec012
|
@ -96,24 +96,30 @@ module.exports = function Section(name, description, types) {
|
|||
*/
|
||||
|
||||
this.mount = function(name, section) {
|
||||
if ( arguments.length == 1 ){
|
||||
var that = this;
|
||||
|
||||
if (arguments.length == 1) {
|
||||
section = arguments[0];
|
||||
|
||||
if ( ! ( section instanceof Section ) )
|
||||
|
||||
if (!(section instanceof Section))
|
||||
throw new Error("Single argument to mount must be a Section!");
|
||||
|
||||
|
||||
var addRoutes = section.getRoutes();
|
||||
|
||||
Object.keys(addRoutes).forEach(function( method){
|
||||
routes[method] = [].concat( routes[method], addRoutes[method] );
|
||||
|
||||
Object.keys(addRoutes).forEach(function(method) {
|
||||
var r = addRoutes[method];
|
||||
r.forEach(function(route) {
|
||||
route.parent = that;
|
||||
})
|
||||
routes[method] = [].concat(routes[method], r);
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!sections[name])
|
||||
sections[name] = [];
|
||||
|
||||
|
||||
section.parent = this;
|
||||
sections[name].push(section);
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue