mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
make navCallback actually versatile
This commit is contained in:
@@ -6,7 +6,7 @@ angular.module("admin.enterprises")
|
||||
# htmlVariable is used by textAngular wysiwyg for the long descrtiption.
|
||||
$scope.htmlVariable = longDescription
|
||||
# Provide a callback for a warning message displayed when leaving the page.
|
||||
$scope.navigationCallback = ->
|
||||
$scope.enterpriseNavCallback = ->
|
||||
"You are editing an enterprise!"
|
||||
|
||||
for payment_method in $scope.PaymentMethods
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
angular.module("admin.utils").directive "navigationCheck", (NavigationCheck)->
|
||||
link: ($scope) ->
|
||||
angular.module("admin.utils").directive "navCheck", (NavigationCheck)->
|
||||
restrict: 'A'
|
||||
scope:
|
||||
navCallback: '&'
|
||||
link: (scope,element,attributes) ->
|
||||
# Define navigationCallback on a controller in $scope, otherwise this default will be used:
|
||||
$scope.navigationCallback ||= ->
|
||||
scope.navCallback ||= ->
|
||||
"You will lose any unsaved work!"
|
||||
NavigationCheck.register($scope.navigationCallback)
|
||||
NavigationCheck.register(scope.navCallback)
|
||||
|
||||
Reference in New Issue
Block a user