TabsCtrl can show tabs that don't toggle

toggle: tabs show on first click and hide on second click
select: tabs show on every click, one tab is always active
This commit is contained in:
Maikel Linke
2014-12-18 15:42:56 +11:00
parent 586753015b
commit 9798b05a24
2 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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}"