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:
Maikel Linke
2014-12-11 12:14:51 +11:00
parent 11f1261dd3
commit 76739a4746
2 changed files with 5 additions and 5 deletions

View File

@@ -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)

View File

@@ -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