fix navigation check on submission

This commit is contained in:
Rafael Schouten
2014-10-22 15:34:09 +11:00
parent a53cbb677d
commit 96ff387d1f
3 changed files with 9 additions and 5 deletions

View File

@@ -1,11 +1,15 @@
angular.module("admin.enterprises")
.controller "enterpriseCtrl", ($scope, longDescription, Enterprise, PaymentMethods, ShippingMethods) ->
.controller "enterpriseCtrl", ($scope, longDescription, NavigationCheck, Enterprise, PaymentMethods, ShippingMethods) ->
$scope.Enterprise = Enterprise.enterprise
$scope.PaymentMethods = PaymentMethods.paymentMethods
$scope.ShippingMethods = ShippingMethods.shippingMethods
$scope.navClear = NavigationCheck.clear
# 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.
# Provide a callback for generating warning messages displayed before leaving the page. This is passed in
# from a directive "nav-check" in the page - if we pass it here it will be called in the test suite,
# and on all new uses of this contoller, and we might not want that .
$scope.enterpriseNavCallback = ->
"You are editing an enterprise!"

View File

@@ -4,7 +4,7 @@
Editing:
= @enterprise.name
= form_for [main_app, :admin, @enterprise] do |f|
= form_for [main_app, :admin, @enterprise], html: { "ng-app" => 'admin.enterprises', "ng-submit" => "navClear()", "ng-controller" => 'enterpriseCtrl' , "nav-check" => '', "nav-callback" => 'enterpriseNavCallback()' } do |f|
= render 'ng_form', f: f
.twelve.columns.alpha
= render partial: 'spree/admin/shared/edit_resource_links'

View File

@@ -3,7 +3,7 @@
- content_for :page_title do
New Enterprise
= form_for [main_app, :admin, @enterprise] do |f|
= render partial: 'ng_form', :locals => { f: f }
= form_for [main_app, :admin, @enterprise], html: { "ng-app" => 'admin.enterprises', "ng-submit" => "navClear()", "ng-controller" => 'enterpriseCtrl' , "nav-check" => '', "nav-callback" => 'enterpriseNavCallback()' } do |f|
= render 'ng_form', f: f
.twelve.columns.alpha
= render partial: 'spree/admin/shared/new_resource_links'