mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Better handling of the home page hubs
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
Darkswarm.controller "HubNodeCtrl", ($scope, Navigation, $location, $anchorScroll) ->
|
||||
$scope.toggle = ->
|
||||
Navigation.navigate $scope.hub.path
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == $scope.hub.path
|
||||
|
||||
if $scope.active()
|
||||
console.log "scrolling baby"
|
||||
$anchorScroll()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
Darkswarm.factory 'Navigation', ($location) ->
|
||||
new class Navigation
|
||||
paths: []
|
||||
path: null
|
||||
path: $location.path()
|
||||
|
||||
navigate: (path = false)->
|
||||
@path = path || @path || @paths[0]
|
||||
|
||||
if $location.path() == @path
|
||||
$location.path("/")
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user