From 365c14d4fe65b1a159fbc08a3958d3bad0318fbf Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 12 Jun 2014 16:16:46 +1000 Subject: [PATCH] Adding smooth scroll to hubses --- .../darkswarm/controllers/hub_node_controller.js.coffee | 5 +---- .../darkswarm/controllers/hubs_controller.js.coffee | 2 +- app/views/home/_hubs.html.haml | 1 + 3 files changed, 3 insertions(+), 5 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 c53f760e7d..b43b97e560 100644 --- a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee @@ -1,4 +1,4 @@ -Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $location, $anchorScroll, $templateCache, CurrentHub) -> +Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $location, $templateCache, CurrentHub) -> $scope.toggle = -> HashNavigation.toggle $scope.hub.hash @@ -7,6 +7,3 @@ Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $locati $scope.current = -> $scope.hub.id is CurrentHub.id - - 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 bd57ee083c..fa40f54c35 100644 --- a/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee @@ -4,4 +4,4 @@ Darkswarm.controller "HubsCtrl", ($scope, Hubs, $anchorScroll, $rootScope, HashN $rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) -> if HashNavigation.active "hubs" - $anchorScroll() + $document.scrollTo $("#hubs"), 100, 200 diff --git a/app/views/home/_hubs.html.haml b/app/views/home/_hubs.html.haml index 7d28d28508..c96ec6698c 100644 --- a/app/views/home/_hubs.html.haml +++ b/app/views/home/_hubs.html.haml @@ -25,6 +25,7 @@ .active_table %hub.active_table_node.row{"ng-repeat" => "hub in filteredHubs = (hubs | hubs:query)", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}", + "scroll-after-load" => true, "ng-controller" => "HubNodeCtrl", id: "{{hub.hash}}"} .small-12.columns