Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix classes needed for JS functionality with 'js-' #743

Open
wants to merge 1 commit into
base: 8.x-2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/cart/commerce_cart.module
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,5 @@ function commerce_cart_views_data_alter(array &$data) {
* Prepares variables for the cart block element template.
*/
function template_preprocess_commerce_cart_block(&$variables) {
$variables['attributes']['class'][] = 'cart--cart-block';
$variables['attributes']['class'][] = 'js-cart--cart-block';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also keep the non js- variant? for theming

}
4 changes: 2 additions & 2 deletions modules/cart/css/commerce_cart.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.cart-block--contents__inner {
padding: 10px;
}
.cart--cart-block .cart-block--contents a {
.js-cart--cart-block .cart-block--contents a {
color: inherit;
}
.cart-block--summary,
Expand All @@ -22,7 +22,7 @@
vertical-align: middle;
}

.cart--cart-block li.cart-block--contents__item {
.js-cart--cart-block li.cart-block--contents__item {
clear: both;
margin-bottom: 10px;
border-bottom: 1px #eaeaea solid;
Expand Down
2 changes: 1 addition & 1 deletion modules/cart/js/commerce_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Drupal.behaviors.commerceCartBlock = {
attach: function (context) {
var $context = $(context);
var $cart = $context.find('.cart--cart-block');
var $cart = $context.find('.js-cart--cart-block');
var $cartButton = $context.find('.cart-block--link__expand');
var $cartContents = $cart.find('.cart-block--contents');

Expand Down
36 changes: 18 additions & 18 deletions modules/checkout/css/commerce_checkout.admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@
* Styles for the checkout flow add/edit form.
*/

.checkout-pane-overview .region-title td {
.js-checkout-pane-overview .region-title td {
font-weight: bold;
}
.checkout-pane-overview .region-message td {
.js-checkout-pane-overview .region-message td {
font-style: italic;
}

.checkout-pane-overview .pane-configuration-summary-cell {
.js-checkout-pane-overview .pane-configuration-summary-cell {
line-height: 1em;
}
.checkout-pane-overview .pane-configuration-summary {
.js-checkout-pane-overview .pane-configuration-summary {
float: left; /* LTR */
font-size: .9em;
}
[dir="rtl"] .checkout-pane-overview .pane-configuration-summary {
[dir="rtl"] .js-checkout-pane-overview .pane-configuration-summary {
float: right;
}
.checkout-pane-overview .pane-configuration-summary-cell .warning {
.js-checkout-pane-overview .pane-configuration-summary-cell .warning {
display: block;
float: left; /* LTR */
margin-right: .5em;
}
[dir="rtl"] .checkout-pane-overview .pane-configuration-summary-cell .warning {
[dir="rtl"] .js-checkout-pane-overview .pane-configuration-summary-cell .warning {
float: right;
}
.checkout-pane-overview .pane-configuration-edit-wrapper {
.js-checkout-pane-overview .pane-configuration-edit-wrapper {
float: right; /* LTR */
}
[dir="rtl"] .checkout-pane-overview .pane-configuration-edit-wrapper {
[dir="rtl"] .js-checkout-pane-overview .pane-configuration-edit-wrapper {
float: left;
}
.checkout-pane-overview .pane-configuration-edit {
.js-checkout-pane-overview .pane-configuration-edit {
float: right; /* LTR */
}
[dir="rtl"] .checkout-pane-overview .pane-configuration-edit {
[dir="rtl"] .js-checkout-pane-overview .pane-configuration-edit {
float: left;
}
.checkout-pane-overview .pane-configuration-editing td {
.js-checkout-pane-overview .pane-configuration-editing td {
vertical-align: top;
}

.checkout-pane-overview tr.pane-configuration-changed {
.js-checkout-pane-overview tr.pane-configuration-changed {
background: #ffffbb;
}
.checkout-pane-overview tr.drag {
.js-checkout-pane-overview tr.drag {
background: #ffee77;
}
.checkout-pane-overview tr.pane-configuration-editing {
.js-checkout-pane-overview tr.pane-configuration-editing {
background: #d5e9f2;
}
.checkout-pane-overview input.pane-configuration-edit {
.js-checkout-pane-overview input.pane-configuration-edit {
margin: 0;
padding: 1px 8px;
}
.checkout-pane-overview .pane-configuration-edit-form .form-item {
.js-checkout-pane-overview .pane-configuration-edit-form .form-item {
margin: 10px 0;
}
.checkout-pane-overview .pane-configuration-edit-form .form-submit {
.js-checkout-pane-overview .pane-configuration-edit-form .form-submit {
margin-bottom: 0;
}
2 changes: 1 addition & 1 deletion modules/checkout/js/commerce_checkout.admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
Drupal.behaviors.checkoutPaneOverview = {
attach: function (context, settings) {
$(context).find('table#checkout-pane-overview').once('checkout-pane-overview').each(function () {
$(context).find('table#checkout-pane-overview').once('js-checkout-pane-overview').each(function () {
Drupal.checkoutPaneOverview.attach(this);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
['data' => $this->t('Settings'), 'colspan' => 2],
],
'#attributes' => [
'class' => ['checkout-pane-overview'],
'class' => ['js-checkout-pane-overview'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

// Used by the JS code when attaching behaviors.
'id' => 'checkout-pane-overview',
],
Expand Down
2 changes: 1 addition & 1 deletion modules/payment/js/offsite-redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
Drupal.behaviors.commercePaymentRedirect = {
attach: function (context) {
$('.payment-redirect-form', context).submit();
$('.js-payment-redirect-form', context).submit();
}
};

Expand Down
2 changes: 1 addition & 1 deletion modules/payment/src/PluginForm/PaymentOffsiteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function buildRedirectForm(array $form, FormStateInterface $form_state
*/
public static function processRedirectForm(array $element, FormStateInterface $form_state, array &$complete_form) {
$complete_form['#action'] = $element['#action'];
$complete_form['#attributes']['class'][] = 'payment-redirect-form';
$complete_form['#attributes']['class'][] = 'js-payment-redirect-form';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous

unset($element['#action']);

return $element;
Expand Down