Skip to content

Commit

Permalink
Always keep one shop tab open (don't toggle closed)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley committed Jan 8, 2020
1 parent 5e56b5f commit 578cfad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Darkswarm.directive "tabsetCtrl", (Tabsets, $location) ->
selected: "@"
navigate: "="
prefix: "@?"
alwaysopen: "="
controller: ($scope, $element) ->
if $scope.navigate
path = $location.path()?.match(/^\/\w+$/)?[0]
$scope.selected = path[1..] if path

this.toggle = (name) ->
Tabsets.toggle($scope.id, name)
state = if $scope.alwaysopen then 'open' else null
Tabsets.toggle($scope.id, name, state)

this.select = (selection) ->
$scope.$broadcast("selection:changed", selection)
Expand Down
2 changes: 1 addition & 1 deletion app/views/shopping_shared/_tabs.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- if tab[:show]
= render "shopping_shared/tabs/#{tab[:name]}"

.tabset-ctrl#shop-tabs{ navigate: 'true', selected: first_visible_tab, prefix: 'shop', ng: { cloak: true } }
.tabset-ctrl#shop-tabs{ navigate: 'true', alwaysopen: 'true', selected: first_visible_tab, prefix: 'shop', ng: { cloak: true } }
.tab-buttons
.row
- shop_tabs.each do |tab|
Expand Down

0 comments on commit 578cfad

Please sign in to comment.