mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user