Skip to content

Commit

Permalink
Fix Theme Check offences (#3283)
Browse files Browse the repository at this point in the history
* Fix schema JSON formatting

Co-authored-by: Abhishek Jani <abhishekdarshanjani@gmail.com>

* Add loading=eager attribute to gift card page img

* Use liquid tag to combine successive liquid statements

Co-authored-by: Abhishek Jani <abhishekdarshanjani@gmail.com>

* Remove snippet to avoid > 3 levels of nested snippets

* Ignore AssetPreload theme check for font links

---------

Co-authored-by: Abhishek Jani <abhishekdarshanjani@gmail.com>
  • Loading branch information
KaichenWang and abhishekjani08 authored Feb 16, 2024
1 parent 9309102 commit a42f234
Show file tree
Hide file tree
Showing 26 changed files with 129 additions and 88 deletions.
4 changes: 4 additions & 0 deletions layout/password.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,14 @@
{% endstyle %}

{%- unless settings.type_body_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_body_font | font_url }}" type="font/woff2" crossorigin>
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}
{%- unless settings.type_header_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_header_font | font_url }}" type="font/woff2" crossorigin>
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}

{{ 'section-password.css' | asset_url | stylesheet_tag }}
Expand Down
4 changes: 4 additions & 0 deletions layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,14 @@
{{ 'base.css' | asset_url | stylesheet_tag }}

{%- unless settings.type_body_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_body_font | font_url }}" type="font/woff2" crossorigin>
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}
{%- unless settings.type_header_font.system? -%}
{% comment %}theme-check-disable AssetPreload{% endcomment %}
<link rel="preload" as="font" href="{{ settings.type_header_font | font_url }}" type="font/woff2" crossorigin>
{% comment %}theme-check-enable AssetPreload{% endcomment %}
{%- endunless -%}

{%- if localization.available_countries.size > 1 or localization.available_languages.size > 1 -%}
Expand Down
4 changes: 3 additions & 1 deletion sections/announcement-bar.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@
"max_blocks": 12,
"class": "announcement-bar-section",
"enabled_on": {
"groups": ["header"]
"groups": [
"header"
]
},
"settings": [
{
Expand Down
10 changes: 8 additions & 2 deletions sections/collage.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down Expand Up @@ -412,7 +415,10 @@
{
"type": "video_url",
"id": "video_url",
"accept": ["youtube", "vimeo"],
"accept": [
"youtube",
"vimeo"
],
"default": "https://www.youtube.com/watch?v=_9VUPq3SxOc",
"label": "t:sections.collage.blocks.video.settings.video_url.label",
"placeholder": "t:sections.collage.blocks.video.settings.video_url.placeholder",
Expand Down
5 changes: 4 additions & 1 deletion sections/collapsible-content.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/collection-list.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@
"class": "section section-collection-list",
"max_blocks": 15,
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/contact-form.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
4 changes: 3 additions & 1 deletion sections/email-signup-banner.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@
]
}
],
"templates": ["password"]
"templates": [
"password"
]
}
{% endschema %}
5 changes: 4 additions & 1 deletion sections/featured-blog.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@
"name": "t:sections.featured-blog.name",
"tag": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/featured-collection.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
11 changes: 8 additions & 3 deletions sections/featured-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@
{%- endif -%}
</div>
{%- when 'share' -%}
{% assign share_url = product.selected_variant.url | default: product.url | prepend: request.origin %}
{% render 'share-button', block: block, share_link: share_url %}
{% liquid
assign share_url = product.selected_variant.url | default: product.url | prepend: request.origin
render 'share-button', block: block, share_link: share_url
%}
{%- when 'variant_picker' -%}
{% render 'product-variant-picker',
product: product,
Expand Down Expand Up @@ -700,7 +702,10 @@
"tag": "section",
"class": "section section-featured-product",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"blocks": [
{
Expand Down
2 changes: 1 addition & 1 deletion sections/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
"label": "t:sections.all.colors.label",
"default": "scheme-1"
},
{
{
"type": "color_scheme",
"id": "menu_color_scheme",
"label": "t:sections.header.settings.menu_color_scheme.label",
Expand Down
5 changes: 4 additions & 1 deletion sections/image-banner.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/image-with-text.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@
"name": "t:sections.image-with-text.name",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
8 changes: 3 additions & 5 deletions sections/main-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,10 @@
{{- block.settings.text -}}
</a>
{%- when 'share' -%}
{% assign share_url = product.selected_variant.url | default: product.url | prepend: request.origin %}
{% render 'share-button',
block: block,
share_link: share_url
{% liquid
assign share_url = product.selected_variant.url | default: product.url | prepend: request.origin
render 'share-button', block: block, share_link: share_url
%}

{%- when 'variant_picker' -%}
{% render 'product-variant-picker', product: product, block: block, product_form_id: product_form_id %}
{%- when 'buy_buttons' -%}
Expand Down
5 changes: 4 additions & 1 deletion sections/multicolumn.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@
"class": "section",
"tag": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/multirow.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@
"name": "t:sections.multirow.name",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
4 changes: 3 additions & 1 deletion sections/newsletter.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header"]
"groups": [
"header"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/page.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
4 changes: 3 additions & 1 deletion sections/quick-order-list.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@
"name": "t:sections.quick-order-list.name",
"limit": 1,
"enabled_on": {
"templates": ["product"]
"templates": [
"product"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/rich-text.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
5 changes: 4 additions & 1 deletion sections/slideshow.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down
10 changes: 8 additions & 2 deletions sections/video.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@
"tag": "section",
"class": "section",
"disabled_on": {
"groups": ["header", "footer"]
"groups": [
"header",
"footer"
]
},
"settings": [
{
Expand Down Expand Up @@ -209,7 +212,10 @@
{
"type": "video_url",
"id": "video_url",
"accept": ["youtube", "vimeo"],
"accept": [
"youtube",
"vimeo"
],
"default": "https://www.youtube.com/watch?v=_9VUPq3SxOc",
"label": "t:sections.video.settings.video_url.label",
"info": "t:sections.video.settings.video_url.info"
Expand Down
42 changes: 28 additions & 14 deletions snippets/product-variant-options.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,35 @@
{%- endcapture %}

{%- if picker_type == 'swatch' -%}
{% assign checked = false %}
{% if option.selected_value == value %}
{% assign checked = true %}
{% endif %}
{%
render 'swatch-input',
id: input_id,
name: option.name,
value: value | escape,
product_form_id: product_form_id,
checked: checked,
disabled: option_disabled,
shape: block.settings.swatch_shape,
help_text: label_unavailable
{% liquid
assign checked = false

if option.selected_value == value
assign checked = true
endif

assign value_text = value | escape
%}
<input
type="radio"
id="{{ input_id }}"
name="{{ option.name }}"
value="{{ value_text }}"
form="{{ product_form_id }}"
class="swatch-input__input{% if option_disabled %} disabled{% endif %}"
{% if checked %}
checked
{% endif %}
>
<label
for="{{ input_id }}"
title="{{ value_text }}"
class="swatch-input__label{% if block.settings.swatch_shape == 'square' %} swatch-input__label--square{% endif %}"
>
{% render 'swatch', swatch: value.swatch, shape: block.settings.swatch_shape %}
<span class="visually-hidden">{{ value_text }}</span>
{{ label_unavailable }}
</label>
{%- elsif picker_type == 'button' -%}
<input
type="radio"
Expand Down
Loading

0 comments on commit a42f234

Please sign in to comment.