diff --git a/app/assets/javascripts/darkswarm/controllers/tabs_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/tabs_controller.js.coffee index 0bbe0bbd23..74ce167580 100644 --- a/app/assets/javascripts/darkswarm/controllers/tabs_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/tabs_controller.js.coffee @@ -1,10 +1,14 @@ -Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location, OrderCycle) -> +Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) -> # Return active if supplied path matches url hash path. $scope.active = (path)-> $location.hash() == path + # 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.select = (path)-> + $scope.toggle = (path)-> if $scope.active(path) $location.hash "" else diff --git a/app/views/shopping_shared/_tabs.html.haml b/app/views/shopping_shared/_tabs.html.haml index d136efa045..90ecc663ea 100644 --- a/app/views/shopping_shared/_tabs.html.haml +++ b/app/views/shopping_shared/_tabs.html.haml @@ -11,6 +11,6 @@ %tab.columns{heading: heading, id: "tab_#{name}", active: "active(\'#{name}\')", - select: "select(\'#{name}\')", + select: "toggle(\'#{name}\')", class: "small-12 medium-#{cols}" } = render "shopping_shared/#{name}"