mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Unify nav-check and nav-callback attributes in nav-check-callback
The value of nav-check was not used and nav-callback was only important if nav-check was given. So we need only one attribute, now named nav-check-callback.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
angular.module("admin.utils").directive "navCheck", (NavigationCheck)->
|
||||
angular.module("admin.utils").directive "navCheckCallback", (NavigationCheck)->
|
||||
restrict: 'A'
|
||||
scope:
|
||||
navCallback: '&'
|
||||
navCheckCallback: '&'
|
||||
link: (scope,element,attributes) ->
|
||||
# Define navigationCallback on a controller in scope, otherwise this default will be used:
|
||||
callback = scope.navCallback()
|
||||
# Provide a callback, otherwise this default will be used:
|
||||
callback = scope.navCheckCallback()
|
||||
callback ||= ->
|
||||
"You will lose any unsaved work!"
|
||||
NavigationCheck.register(callback)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= form_for [main_app, :admin, @enterprise], html: { name: "enterprise", "ng-app" => 'admin.enterprises', "ng-submit" => "navClear()", "ng-controller" => 'enterpriseCtrl' , "nav-check" => '', "nav-callback" => 'enterpriseNavCallback' } do |f|
|
||||
= form_for [main_app, :admin, @enterprise], html: { name: "enterprise", "ng-app" => 'admin.enterprises', "ng-submit" => "navClear()", "ng-controller" => 'enterpriseCtrl', "nav-check-callback" => 'enterpriseNavCallback' } do |f|
|
||||
.row
|
||||
.sixteen.columns.alpha
|
||||
.eleven.columns.alpha.fullwidth_inputs
|
||||
|
||||
Reference in New Issue
Block a user