app/js/framework.js in storys-0.0.5 vs app/js/framework.js in storys-0.0.6
- old
+ new
@@ -62,25 +62,31 @@
var currentController = null;
var currentRoute = null;
this.init = function() {
+ _.each(controllers, function(controller) {
+ controller.setup();
+ });
+
$(window).bind("hashchange", function() {
var route = utils.location().route;
if(route == "") return;
if(route != currentRoute) {
console.log("changing route from ", currentRoute, " to ", route);
currentRoute = route;
if(currentController) {
+ $(".current-view .navbar-content").append($("#navbar-content-target").contents().detach());
currentController.destroy();
delete currentController;
}
var controllerFunction = controllers[utils.location().controller];
currentController = new (controllerFunction.bind.apply(controllerFunction, [null].concat(utils.location().params)));
currentController.init();
+ $("#navbar-content-target").empty().append($(".current-view .navbar-content").contents().detach());
}
currentController.render();
}).trigger("hashchange");
}