diff --git a/app/assets/javascripts/admin/utils/directives/navigation_check.js.coffee b/app/assets/javascripts/admin/utils/directives/navigation_check.js.coffee index da25286505..fee80e9acf 100644 --- a/app/assets/javascripts/admin/utils/directives/navigation_check.js.coffee +++ b/app/assets/javascripts/admin/utils/directives/navigation_check.js.coffee @@ -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) diff --git a/app/views/admin/enterprises/_ng_form.html.haml b/app/views/admin/enterprises/_ng_form.html.haml index d3ea41d88f..feb46b840f 100644 --- a/app/views/admin/enterprises/_ng_form.html.haml +++ b/app/views/admin/enterprises/_ng_form.html.haml @@ -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