Skip to content

Commit 4befb8e

Browse files
author
Denys Rul
committed
MAGETWO-33941: Customer scripts to eliminate (2 scripts)
- Complete missed scripts
1 parent 1fc8368 commit 4befb8e

File tree

3 files changed

+43
-40
lines changed

3 files changed

+43
-40
lines changed

app/code/Magento/Customer/view/frontend/templates/address/book.phtml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@
9999
<a class="action back" href="<?php echo $block->escapeUrl($block->getBackUrl()) ?>"><span><?php echo __('Back') ?></span></a>
100100
</div>
101101
</div>
102-
103-
<script>
104-
require(['jquery', "mage/mage"], function(jQuery){
105-
106-
jQuery('.page-main').mage('address', {
107-
deleteAddress: "li.item a[role='delete-address']",
108-
deleteUrlPrefix: '<?php echo $block->getDeleteUrl() ?>id/',
109-
addAddress: "button[role='add-address']",
110-
addAddressLocation: '<?php echo $block->getAddAddressUrl() ?>'
111-
});
112-
113-
});
102+
<script type="text/x-magento-init">
103+
{
104+
".page-main": {
105+
"address": {
106+
"deleteAddress": "li.item a[role='delete-address']",
107+
"deleteUrlPrefix": "<?php echo $block->getDeleteUrl() ?>id/",
108+
"addAddress": "button[role='add-address']",
109+
"addAddressLocation": "<?php echo $block->getAddAddressUrl() ?>"
110+
}
111+
}
112+
}
114113
</script>

app/code/Magento/Customer/view/frontend/templates/address/edit.phtml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,22 @@
132132
</div>
133133
</div>
134134
</form>
135-
<script>
136-
require([
137-
"jquery",
138-
"mage/validation",
139-
"Magento_Checkout/js/region-updater"
140-
], function($){
141-
var $form = $('#form-validate');
142-
$form.validation();
143-
$('#country').regionUpdater({
144-
optionalRegionAllowed: <?php echo($block->getConfig('general/region/display_all') ? 'true' : 'false'); ?>,
145-
regionListId: '#region_id',
146-
regionInputId: '#region',
147-
postcodeId: '#zip',
148-
form: $form,
149-
regionJson: <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
150-
defaultRegion: "<?php echo $block->getRegionId() ?>",
151-
countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
152-
});
153-
});
135+
<script type="text/x-magento-init">
136+
{
137+
"#form-validate": {
138+
"validation": {}
139+
},
140+
"#country": {
141+
"regionUpdater": {
142+
"optionalRegionAllowed": <?php echo($block->getConfig('general/region/display_all') ? 'true' : 'false'); ?>,
143+
"regionListId": "#region_id",
144+
"regionInputId": "#region",
145+
"postcodeId": "#zip",
146+
"form": "#form-validate",
147+
"regionJson": <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
148+
"defaultRegion": "<?php echo $block->getRegionId() ?>",
149+
"countriesWithOptionalZip": <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
150+
}
151+
}
152+
}
154153
</script>

app/code/Magento/Customer/view/frontend/templates/form/edit.phtml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,9 @@
7272
"jquery",
7373
"mage/mage"
7474
], function($){
75-
76-
$('#change-password').mage('setPassword', {
77-
'currentPasswordId': '#current-password',
78-
'passwordId': '#password',
79-
'confirmationId': '#password-confirmation',
80-
'passwordContainer': 'fieldset.fieldset.password',
81-
'showOnDefault': <?php echo $block->getChangePassword() ? 'true' : 'false' ?>
82-
});
83-
8475
var dataForm = $('#form-validate');
8576
var ignore = <?php echo $_dob->isEnabled() ? '\'input[id$="full"]\'' : 'null'; ?>;
77+
8678
dataForm.mage('validation', {
8779
<?php if ($_dob->isEnabled()): ?>
8880
errorPlacement: function(error, element) {
@@ -105,3 +97,16 @@
10597

10698
});
10799
</script>
100+
<script type="text/x-magento-init">
101+
{
102+
"#change-password": {
103+
"setPassword": {
104+
"currentPasswordId": "#current-password",
105+
"passwordId": "#password",
106+
"confirmationId": "#password-confirmation",
107+
"passwordContainer": "fieldset.fieldset.password",
108+
"showOnDefault": <?php echo $block->getChangePassword() ? 'true' : 'false' ?>
109+
}
110+
}
111+
}
112+
</script>

0 commit comments

Comments
 (0)