From 76739a47460c22cd203ecbce17b27561402a9c36 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 11 Dec 2014 12:14:51 +1100 Subject: [PATCH] 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. --- .../admin/utils/directives/navigation_check.js.coffee | 8 ++++---- app/views/admin/enterprises/_ng_form.html.haml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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