Skip to content

Commit

Permalink
Merge pull request #446 from magento-troll/MAGETWO-55838
Browse files Browse the repository at this point in the history
MAGETWO-55838: [Add address] Same address can be added several times at once
  • Loading branch information
rganin authored Sep 30, 2016
2 parents f39ad29 + 40224b8 commit a49169e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/code/Magento/Customer/view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var config = {
address: 'Magento_Customer/address',
changeEmailPassword: 'Magento_Customer/change-email-password',
passwordStrengthIndicator: 'Magento_Customer/js/password-strength-indicator',
zxcvbn: 'Magento_Customer/js/zxcvbn'
zxcvbn: 'Magento_Customer/js/zxcvbn',
addressValidation: 'Magento_Customer/js/addressValidation'
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<script type="text/x-magento-init">
{
"#form-validate": {
"validation": {}
"addressValidation": {}
},
"#country": {
"regionUpdater": {
Expand Down
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;
});

0 comments on commit a49169e

Please sign in to comment.