Skip to content

Commit

Permalink
update for magento#6207: generated id should also be used for label attr
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Leers committed Aug 18, 2016
1 parent 9942c49 commit 9dced37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ define(
modalContent: ko.observable(null),
modalWindow: null,

selectedPaymentMethod: function() {
return quote.paymentMethod() ? quote.paymentMethod().method : "";
/**
* build a unique id for the term checkbox
*
* @param parents
* @param agreementId
*/
getCheckboxId: function(parents, agreementId) {
var paymentMethodName = (parents[2].item) ? parents[2].item.method : '';
return 'agreement_' + paymentMethodName + '_' + agreementId;
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<div class="checkout-agreement">
<input type="checkbox"
data-bind="attr: {
'id': 'agreement_' + $parent.selectedPaymentMethod() + '_' + agreementId,
'id': $parent.getCheckboxId($parents, agreementId),
'name': 'agreement[' + agreementId + ']',
'value': agreementId
}"
data-validate="{required:true}" />
<label data-bind="attr: {'for': 'agreement_' + agreementId}">
<label data-bind="attr: {'for': $parent.getCheckboxId($parents, agreementId)}">
<button type="button"
class="action action-show"
data-bind="click: function(data, event) { return $parent.showContent(data, event) }"
Expand All @@ -39,4 +39,4 @@
<div class="checkout-agreements-item-content" data-bind="html: modalContent"></div>
</div>
</div>
</div>
</div>

0 comments on commit 9dced37

Please sign in to comment.