mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Let shopping tabs listen to URL changes
When clicking on a shopping tab like "contact", it changed the URL. But changing the URL did not change the tab. Listening to URL changes enables manual manipulation of the URL and simple links to "#/contact" to open the contact tab.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation) ->
|
||||
Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation, $location) ->
|
||||
angular.extend this, $controller('TabsCtrl', {$scope: $scope})
|
||||
|
||||
$scope.tabs =
|
||||
@@ -6,3 +6,7 @@ Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation) ->
|
||||
producers: { active: Navigation.isActive('/producers') }
|
||||
contact: { active: Navigation.isActive('/contact') }
|
||||
groups: { active: Navigation.isActive('/groups') }
|
||||
|
||||
$scope.$on '$locationChangeStart', (event, url) ->
|
||||
tab = $location.path().replace(/^\//, '')
|
||||
$scope.tabs[tab]?.active = true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
register: ('<a auth="signup">' + t('.register') + '</a>').html_safe}
|
||||
- else
|
||||
= t '.require_customer_html',
|
||||
{contact: ('<a href="##contact">' + t('.contact') + '</a>').html_safe,
|
||||
{contact: link_to(t('.contact'), '#contact'),
|
||||
enterprise: current_distributor.name}
|
||||
- elsif @order_cycles and @order_cycles.empty?
|
||||
- if current_distributor.preferred_shopfront_closed_message.present?
|
||||
|
||||
Reference in New Issue
Block a user