Files
openfoodnetwork/app/assets/javascripts/darkswarm/controllers/tabs_controller.js.coffee
Will Marshall 89fcf50762 Tidying up tabs
2014-03-27 16:36:12 +11:00

19 lines
479 B
CoffeeScript

Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location, OrderCycle) ->
$scope.active = (path)->
if !OrderCycle.selected() and $location.hash() == "" and path == "about"
true
else
$location.hash() == path
$scope.tabs = ["contact", "about", "groups", "producers"]
for tab in $scope.tabs
$scope[tab] =
path: tab
$scope.select = (tab)->
if $scope.active(tab.path)
$location.hash ""
else
$location.hash tab.path