Skip to content

Commit

Permalink
fix(storefront): BCTHEME-906 Hide prices for aria-label and data-prod…
Browse files Browse the repository at this point in the history
…uct-price attributes if set to Hidden for guests
  • Loading branch information
“bc-yevhenii-buliuk” committed Oct 18, 2021
1 parent 31ac15a commit be6936d
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Hide prices for aria-label and data-product-price attributes if set to "Hidden for guests". Hide currency selection for non-logged in users. [#2131](https://github.com/bigcommerce/cornerstone/pull/2131)
- Added settings for payment banners. [#2021](https://github.com/bigcommerce/cornerstone/pull/2021)
- Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039)
- Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047)
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"change": "Change",
"sign_up": "Register",
"login": "Sign in",
"login_for_pricing": "Log in for pricing",
"logout": "Sign out",
"account": "Account",
"cart": "Cart",
Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/login-for-pricing.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p translate>Log in for pricing</p>
<p translate>{{lang 'common.login_for_pricing'}}</p>
4 changes: 3 additions & 1 deletion templates/components/common/navigation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<nav class="navUser">
{{> components/common/currency-selector}}
{{#if customer.id}}
{{> components/common/currency-selector}}
{{/if}}

<ul class="navUser-section navUser-section--alt">
{{#if customer.store_credit.value '>' 0}}
Expand Down
27 changes: 21 additions & 6 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
{{/each}}"
data-product-brand="{{brand.name}}"
data-product-price="
{{#if price.with_tax}}
{{price.with_tax.value}}
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
{{else}}
{{price.without_tax.value}}
{{/if}}"
{{lang 'common.login_for_pricing'}}
{{/or}}"
{{/if}}>
<figure class="card-figure">
{{#if stock_level '===' 0}}
Expand All @@ -39,9 +43,15 @@
}}
{{/or}}
{{/if}}

<a href="{{url}}"
class="card-figure__link"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}
>
<div class="card-img-container">
Expand Down Expand Up @@ -103,7 +113,12 @@
<p class="card-text" data-test-info-type="brandName">{{brand.name}}</p>
{{/if}}
<h3 class="card-title">
<a aria-label="{{name}},{{> components/products/product-aria-label}}"
<a aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
href="{{url}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>{{name}}</a>
</h3>
Expand Down
25 changes: 22 additions & 3 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{{#if settings.data_tag_enabled}}
<article class="listItem" data-event-type="{{event}}" data-entity-id="{{id}}" data-position="{{position}}" data-name="{{name}}" data-product-category="{{#each category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{brand.name}}" data-product-price="{{#if price.with_tax}}{{price.with_tax.value}}{{else}}{{price.without_tax.value}}{{/if}}">
<article class="listItem" data-event-type="{{event}}" data-entity-id="{{id}}" data-position="{{position}}" data-name="{{name}}" data-product-category="{{#each category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{brand.name}}" data-product-price="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}">
{{else}}
<article class="listItem">
{{/if}}
<figure class="listItem-figure">
<a href="{{url}}"
class="listItem-figure__link"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
Expand Down Expand Up @@ -53,7 +67,12 @@
{{/if}}
<h4 class="listItem-title">
<a href="{{url}}"
aria-label="{{name}},{{> components/products/product-aria-label}}"
aria-label="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{name}},{{> components/products/product-aria-label}}
{{else}}
{{name}}
{{/or}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
Expand Down
13 changes: 12 additions & 1 deletion templates/components/products/product-view.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<div class="productView" {{#if settings.data_tag_enabled}} data-event-type="product" data-entity-id="{{product.id}}" data-name="{{product.title}}" data-product-category="{{#each product.category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{product.brand.name}}" data-product-price="{{#if product.price.with_tax}}{{product.price.with_tax.value}}{{else}}{{product.price.without_tax.value}}{{/if}}" data-product-variant="single-product-option"{{/if}}>
<div class="productView" {{#if settings.data_tag_enabled}} data-event-type="product" data-entity-id="{{product.id}}" data-name="{{product.title}}" data-product-category="{{#each product.category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{product.brand.name}}"
data-product-price="
{{#or customer (if theme_settings.restrict_to_login '===' false)}}
{{#if product.price.with_tax}}
{{product.price.with_tax.value}}
{{else}}
{{product.price.without_tax.value}}
{{/if}}
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}"
data-product-variant="single-product-option"{{/if}}>
{{#each product.reviews.messages}}
{{#if error}}
{{> components/common/alert/alert-error error}}
Expand Down

0 comments on commit be6936d

Please sign in to comment.