From ab64de58388adb8b5f7f6f3bd6b3455ea0c9db41 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 8 May 2014 16:59:18 +1000 Subject: [PATCH] And patching bugs in nav --- .../darkswarm/controllers/hub_node_controller.js.coffee | 3 +++ .../darkswarm/controllers/hubs_controller.js.coffee | 6 +++++- .../controllers/producer_node_controller.js.coffee | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee index b944607886..6eeecc2775 100644 --- a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee @@ -14,3 +14,6 @@ Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, $location, $anchorS $scope.changeHub = -> if confirm "Are you sure? This will change your selected Hub and remove any items in you shopping cart." Navigation.go $scope.hub.path + + if $scope.open() + $anchorScroll() diff --git a/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee index 0be4166dcb..bd57ee083c 100644 --- a/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee @@ -1,3 +1,7 @@ -Darkswarm.controller "HubsCtrl", ($scope, Hubs) -> +Darkswarm.controller "HubsCtrl", ($scope, Hubs, $anchorScroll, $rootScope, HashNavigation) -> $scope.Hubs = Hubs $scope.hubs = Hubs.hubs + + $rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) -> + if HashNavigation.active "hubs" + $anchorScroll() diff --git a/app/assets/javascripts/darkswarm/controllers/producer_node_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/producer_node_controller.js.coffee index 733e0d6798..2f3bf1ce00 100644 --- a/app/assets/javascripts/darkswarm/controllers/producer_node_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/producer_node_controller.js.coffee @@ -1,9 +1,9 @@ -Darkswarm.controller "ProducerNodeCtrl", ($scope, Navigation, $anchorScroll) -> +Darkswarm.controller "ProducerNodeCtrl", ($scope, HashNavigation, $anchorScroll) -> $scope.toggle = -> - Navigation.navigate $scope.producer.path + HashNavigation.navigate $scope.producer.hash $scope.open = -> - Navigation.active($scope.producer.path) + HashNavigation.active($scope.producer.hash) if $scope.open() $anchorScroll()