Skip to content

Commit da7fef9

Browse files
author
Denys Rul
committed
MAGETWO-32484: Stabilization of changes and bug fixing
- Change components initialization
1 parent bb21de7 commit da7fef9

File tree

3 files changed

+25
-59
lines changed

3 files changed

+25
-59
lines changed

app/code/Magento/Checkout/view/frontend/templates/onepage.phtml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,34 @@ $_paymentBlock = $this->getLayout()->getBlock('checkout.onepage.payment');
2525
</ol>
2626
<script>
2727
require([
28-
"jquery",
29-
"mage/mage"
30-
], function($){
28+
"underscore",
29+
"accordion",
30+
"opcOrderReview",
31+
], function(_, accordion, opcOrderReview){
3132
'use strict';
3233

33-
$(document).ready(function() {
34-
$('#checkoutSteps').mage('accordion',{
35-
'collapsibleElement' : ' > li',
36-
'openedState' : 'active'
37-
}).mage('opcOrderReview', $.extend({
38-
'checkoutAgreements': '#checkout-agreements',
39-
'checkoutProgressContainer': '#checkout-progress-wrapper',
40-
'methodDescription': '.items'
41-
},
42-
<?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($_paymentBlock->getOptions()); ?>
43-
));
44-
});
34+
/**
35+
* @todo refactor opcCheckoutMethod
36+
*
37+
* Initializiation of this components can't be moved to a data-mage-init attribute
38+
* due to dependencies between instances of opcCheckoutMethod and mage.accordion.
39+
* Thus initializiation has to be synchronyous.
40+
*/
41+
var elem = document.getElementById('checkoutSteps'),
42+
opcConfig;
4543

44+
opcConfig = _.extend({
45+
'checkoutAgreements': '#checkout-agreements',
46+
'checkoutProgressContainer': '#checkout-progress-wrapper',
47+
'methodDescription': '.items'
48+
},<?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($_paymentBlock->getOptions()); ?>);
49+
50+
accordion({
51+
'collapsibleElement': ' > li',
52+
'openedState': 'active'
53+
}, elem);
54+
55+
opcOrderReview(opcConfig, elem);
4656
});
4757
</script>
4858
</div>

app/code/Magento/Checkout/view/frontend/web/js/accordion.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ define([
1010
"jquery",
1111
"jquery/ui",
1212
"mage/validation/validation",
13-
"Magento_Checkout/js/accordion",
1413
"mage/translate"
1514
], function($){
1615
'use strict';

0 commit comments

Comments
 (0)