Fix HashNavigation reload bug

This commit is contained in:
Matt-Yorkley
2019-05-10 01:52:27 +01:00
parent ae8f1a92e8
commit 1b8dfaf049
2 changed files with 18 additions and 4 deletions

View File

@@ -1,7 +1,11 @@
Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $location, $templateCache, CurrentHub, $http) ->
Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $location, CurrentHub, $http, $timeout) ->
$scope.shopfront_loading = false
$scope.enterprise_details = []
$timeout ->
if $scope.open()
$scope.load_shopfront()
# Toggles shopfront tabs open/closed. Fetches enterprise details from the api, diplays them and adds them
# to $scope.enterprise_details, or simply displays the details again if previously fetched
$scope.toggle = (event) ->
@@ -14,6 +18,9 @@ Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $locati
$scope.toggle_tab(event)
return
$scope.load_shopfront(event)
$scope.load_shopfront = (event=null) ->
$scope.shopfront_loading = true
$scope.toggle_tab(event)
@@ -26,7 +33,7 @@ Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $locati
console.error(data)
$scope.toggle_tab = (event) ->
HashNavigation.toggle $scope.hub.hash if !angular.element(event.target).inheritedData('is-link')
HashNavigation.toggle $scope.hub.hash if event && !angular.element(event.target).inheritedData('is-link')
# Returns boolean: pulldown tab is currently open/closed
$scope.open = ->

View File

@@ -1,7 +1,11 @@
Darkswarm.controller "ProducerNodeCtrl", ($scope, HashNavigation, $anchorScroll, $http) ->
Darkswarm.controller "ProducerNodeCtrl", ($scope, HashNavigation, $anchorScroll, $http, $timeout) ->
$scope.shopfront_loading = false
$scope.enterprise_details = []
$timeout ->
if $scope.open()
$scope.load_shopfront()
# Toggles shopfront tabs open/closed. Fetches enterprise details from the api, diplays them and adds them
# to $scope.enterprise_details, or simply displays the details again if previously fetched
$scope.toggle = (event) ->
@@ -14,6 +18,9 @@ Darkswarm.controller "ProducerNodeCtrl", ($scope, HashNavigation, $anchorScroll,
$scope.toggle_tab(event)
return
$scope.load_shopfront(event)
$scope.load_shopfront = (event=null) ->
$scope.shopfront_loading = true
$scope.toggle_tab(event)
@@ -26,7 +33,7 @@ Darkswarm.controller "ProducerNodeCtrl", ($scope, HashNavigation, $anchorScroll,
console.error(data)
$scope.toggle_tab = (event) ->
HashNavigation.toggle $scope.producer.hash if !angular.element(event.target).inheritedData('is-link')
HashNavigation.toggle $scope.producer.hash if event && !angular.element(event.target).inheritedData('is-link')
$scope.open = ->
HashNavigation.active($scope.producer.hash)