-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #446 from magento-troll/MAGETWO-55838
MAGETWO-55838: [Add address] Same address can be added several times at once
- Loading branch information
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/code/Magento/Customer/view/frontend/web/js/addressValidation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
/*jshint browser:true jquery:true*/ | ||
define([ | ||
'jquery', | ||
'jquery/ui', | ||
'validation' | ||
], function ($) { | ||
'use strict'; | ||
|
||
$.widget('mage.addressValidation', { | ||
options: { | ||
selectors: { | ||
button: '[data-action=save-address]' | ||
} | ||
}, | ||
|
||
/** | ||
* Validation creation | ||
* @protected | ||
*/ | ||
_create: function () { | ||
var button = $(this.options.selectors.button, this.element); | ||
|
||
this.element.validation({ | ||
|
||
/** | ||
* Submit Handler | ||
* @param {Element} form - address form | ||
*/ | ||
submitHandler: function (form) { | ||
|
||
button.attr('disabled', true); | ||
form.submit(); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
return $.mage.addressValidation; | ||
}); |