Hash Navigation works on with Group and Shopping page tabs

This commit is contained in:
Rob Harrington
2016-05-13 15:33:23 +10:00
parent 92d8ee1a36
commit 93a4f19b40
7 changed files with 32 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "GroupPageCtrl", ($scope, group_enterprises, Enterprises, MapConfiguration, OfnMap, visibleFilter) ->
Darkswarm.controller "GroupPageCtrl", ($scope, group_enterprises, Enterprises, MapConfiguration, OfnMap, visibleFilter, Navigation) ->
$scope.Enterprises = Enterprises
all_enterprises_by_id = Enterprises.enterprises_by_id
@@ -19,4 +19,3 @@ Darkswarm.controller "GroupPageCtrl", ($scope, group_enterprises, Enterprises, M
$scope.map = angular.copy MapConfiguration.options
$scope.mapMarkers = OfnMap.enterprise_markers visible_enterprises

View File

@@ -0,0 +1,8 @@
Darkswarm.controller "GroupTabsCtrl", ($scope, $controller, Navigation) ->
angular.extend this, $controller('TabsCtrl', {$scope: $scope})
$scope.tabs =
map: { active: Navigation.isActive('/map') }
about: { active: Navigation.isActive('/about') }
producers: { active: Navigation.isActive('/producers') }
hubs: { active: Navigation.isActive('/hubs') }

View File

@@ -1,3 +1,3 @@
Darkswarm.controller "GroupsCtrl", ($scope, Groups, $anchorScroll, $rootScope) ->
Darkswarm.controller "GroupsCtrl", ($scope, Groups) ->
$scope.Groups = Groups
$scope.order = 'position'

View File

@@ -0,0 +1,8 @@
Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation) ->
angular.extend this, $controller('TabsCtrl', {$scope: $scope})
$scope.tabs =
about: { active: Navigation.isActive('/about') }
producers: { active: Navigation.isActive('/producers') }
contact: { active: Navigation.isActive('/contact') }
groups: { active: Navigation.isActive('/groups') }

View File

@@ -1,15 +1,6 @@
Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
# Return active if supplied path matches url hash path.
$scope.active = (path)->
$location.hash() == path
Darkswarm.controller "TabsCtrl", ($scope, Navigation) ->
$scope.isActive = Navigation.isActive
# Select tab by setting the url hash path.
$scope.select = (path)->
$location.hash path
# Toggle tab selected status by setting the url hash path.
$scope.toggle = (path)->
if $scope.active(path)
$location.hash ""
else
$location.hash path
$scope.select = (path) ->
Navigation.navigate path