Skip to content

Commit

Permalink
Merge pull request #2261 from boltdesignsystem/feature/DS-489-twig-de…
Browse files Browse the repository at this point in the history
…precations

DS-489 twig deprecations
  • Loading branch information
colbytcook committed Jul 15, 2021
2 parents c9426c0 + 299a8d3 commit 1440ccd
Show file tree
Hide file tree
Showing 53 changed files with 95 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@
<!-- default value -->
<td class="c-bds-docs-table__col">

{% if prop.default is sameas(false) %}
{% if prop.default is same as(false) %}
<code>false</code>
{% elseif prop.default is sameas(true) %}
{% elseif prop.default is same as(true) %}
<code>true</code>
{% elseif prop.default is empty %}
Expand Down Expand Up @@ -273,9 +273,9 @@
<!-- default value -->
<td class="c-bds-docs-table__col">

{% if prop.default is sameas(false) %}
{% if prop.default is same as(false) %}
<code>false</code>
{% elseif prop.default is sameas(true) %}
{% elseif prop.default is same as(true) %}
<code>true</code>
{% elseif prop.default is empty %}
Expand Down Expand Up @@ -338,9 +338,9 @@
<!-- default value -->
<td class="c-bds-docs-table__col">

{% if prop.default is sameas(false) %}
{% if prop.default is same as(false) %}
<code>false</code>
{% elseif prop.default is sameas(true) %}
{% elseif prop.default is same as(true) %}
<code>true</code>
{% elseif prop.default is empty %}
Expand Down Expand Up @@ -413,5 +413,5 @@
</bolt-schema-table>
</div>
</details>
{% endif %}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{% for borderless in [true, false] %}
<h3>
Borderless: {% if borderless is sameas(true) %}true{% elseif borderless is sameas(false) %}false{% endif %}
Borderless: {% if borderless is same as(true) %}true{% elseif borderless is same as(false) %}false{% endif %}
</h3>
<div class="u-bolt-margin-bottom-medium">
{% include "@bolt-components-action-blocks/action-blocks.twig" with {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% set text_demo %}
<bolt-text>
Expand All @@ -15,6 +16,3 @@
</bolt-text>
{% include text_code.code_example(text_demo, true) %}
{% endblock %}



Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% set text_demo %}
<bolt-text display="block">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "@pl/_text-doc-template.twig" %}
{% import "@pl/_text-doc-template.twig" as text_code %}

{% block content %}
<bolt-text headline>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
document.getElementsByTagName("body")[0].setAttribute("class", "e-bolt-printable");
</script>

{% set pageControls = block("page_controls") %}
{% set sideNav = block("side_nav") %}
{% set pageControls = block("page_controls") is defined ? block("page_controls") : '' %}
{% set sideNav = block("side_nav") is defined ? block("side_nav") : '' %}
{% set breadcrumbs = [
{
"text": "Home",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if block("page_content") %}
{% if block("page_content") is defined %}
{% set mainContentBlock %}
{{ block("page_content") }}
{% endset %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "is-" or class starts with "has-" %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with "c-bolt-" == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-accordion/src/accordion.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "is-" or class starts with "has-" %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with "c-bolt-" == false %}
Expand Down
6 changes: 3 additions & 3 deletions packages/components/bolt-action-blocks/src/action-blocks.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
{% endif %}

{# DEPRECATED: use borderless instead #}
{% if border is sameas(true) %}
{% if border is same as(true) %}
{% set borderless = false %}
{% elseif border is sameas(false) %}
{% elseif border is same as(false) %}
{% set borderless = true %}
{% endif %}

Expand Down Expand Up @@ -56,7 +56,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "is-" or class starts with "has-" %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with "c-bolt-" == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-band/src/band.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endif %}

{# Deprecated #}
{% if fullBleed is sameas(true) or fullBleed is sameas(false) %}
{% if fullBleed is same as(true) or fullBleed is same as(false) %}
{% set full_bleed = fullBleed %}
{% endif %}
{# row_gutter, content_row_start, items are also deprecated but this twig still supports them, see more comments below where items are being rendered #}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-banner/src/banner.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'is-' or class starts with 'has-' %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with 'c-bolt-' == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-blockquote/src/blockquote.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "is-" or class starts with "has-" %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with "c-bolt-" == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-button/src/button.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Sort classes passed in via attributes into two groups:
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'is-' == true %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with 'has-' == true %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
{% if _card_replacement_media_content %}
{{ _card_replacement_media_content }}
{% else %}
{% if _card_replacement_image or block('media') %}
{% if _card_replacement_image or block('media') is defined %}
<bolt-card-replacement-media {{ attributes }}>
<ssr-keep for="bolt-card-replacement-media" class="c-bolt-card_replacement__media">
{% if _card_replacement_image %}
{% include '@bolt-components-image/image.twig' with _card_replacement_image only %}
{% elseif block('media') %}
{% elseif block('media') is defined %}
{{ block('media') }}
{% endif %}
</ssr-keep>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
{% set _link_attributes = create_attribute(link.attributes|default({})) %}
{% endif %}

{% if block('background') %}
{% if block('background') is defined %}
{% set _background_block %}
{{ block('background') }}
{% endset %}
{% endif %}

{% if block('media') %}
{% if block('media') is defined %}
{% set _media_block %}
{{ block('media') }}
{% endset %}
{% endif %}

{% if block('body') %}
{% if block('body') is defined %}
{% set _body_block %}
{{ block('body') }}
{% endset %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-chip/src/chip.twig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'is-' or class starts with 'has-' %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with 'c-bolt-' == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-headline/src/_typography.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% set autoshrink = autoshrink is defined ? autoshrink : schema.properties.autoshrink.default %}

{# For backwards compatibility only, setting icon to exactly 'false' is the same as specifying 'none'. Deprecated. #}
{% if icon is sameas(false) %}
{% if icon is same as(false) %}
{% set icon = "none" %}
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions packages/components/bolt-image/src/image.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endif %}

{# DEPRECATED. 'ratio' should be a string, but boolean was previously supported. Boolean is now DEPRECATED. #}
{% if ratio is sameas(false) or ratio is sameas(true) %}
{% if ratio is same as(false) or ratio is same as(true) %}
{% set _ratio_bool = ratio %}
{% else %}
{% set _ratio_string = ratio %}
Expand Down Expand Up @@ -37,7 +37,7 @@
{% set _ph_image = placeholder_image|default(_image_data_bolt.base64|default(schema.properties.placeholder_image.default)) %}

{% set _use_ratio = useAspectRatio or _ratio_bool ?? true %}
{% set _can_use_ratio = _use_ratio is sameas(true) and _ratio_string != 'none' and width > 0 and height > 0 and not cover %}
{% set _can_use_ratio = _use_ratio is same as(true) and _ratio_string != 'none' and width > 0 and height > 0 and not cover %}
{# Only JPGs allowed, PNGs can have transparency and may not look right layered over placeholder #}
{% set _can_use_placeholder = _can_use_ratio or cover %}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-link/src/link.twig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Sort classes passed in via attributes into two groups:
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'is-' or class starts with 'has-' %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with 'c-bolt-' == false %}
Expand Down
4 changes: 2 additions & 2 deletions packages/components/bolt-list/src/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
{% set separator = separator in separator_options ? separator : schema.properties.separator.default %}
{% set align = align in align_options ? align : schema.properties.align.default %}
{% set valign = valign in valign_options ? valign : schema.properties.valign.default %}
{% set inset = inset is sameas(true) or inset is sameas(false) ? inset : schema.properties.inset.default %}
{% set nowrap = nowrap is sameas(true) or nowrap is sameas(false) ? nowrap : schema.properties.nowrap.default %}
{% set inset = inset is same as(true) or inset is same as(false) ? inset : schema.properties.inset.default %}
{% set nowrap = nowrap is same as(true) or nowrap is same as(false) ? nowrap : schema.properties.nowrap.default %}

{# Conditions for the semantic tag usage #}
{% if tag == "ol" or tag == "ul" %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-menu/src/menu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'is-' or class starts with 'has-' %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with 'c-bolt-' == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-modal/src/modal.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% set uuid = this.data.uuid|default(bolt.data.config.env == "test" ? "12345" : random()) %}
{% set outer_classes = [] %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "c-bolt-" == false %}
{% set outer_classes = outer_classes|merge([class]) %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-navbar/src/navbar-li.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'js-bolt-navbar-item'
] %}

{% if this.data.current.value is sameas(true) %}
{% if this.data.current.value is same as(true) %}
{% set attributes = attributes.setAttribute('data-bolt-current') %}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-navbar/src/navbar.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
content ? 'c-bolt-navbar--custom' : ''
] %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% set classes = classes|merge([class]) %}
{% endfor %}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-page-header/src/page-header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% set attributes = attributes.setAttribute('data-bolt-page-header-desktop-bp', bolt.data.breakpoints.large) %}

{# Set data-attribute used by Navbar for calculating offset. #}
{% if this.data.static.value is sameas(false) %}
{% if this.data.static.value is same as(false) %}
{% set attributes = attributes.setAttribute('data-bolt-sticky-header', '') %}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-popover/src/popover.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% set outer_classes = [] %}
{% set inner_classes = classes %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with "is-" or class starts with "has-" %}
{% set inner_classes = inner_classes|merge([class]) %}
{% elseif class starts with "c-bolt-" == false %}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-stack/src/stack.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#}
{% set outer_classes = [] %}

{% for class in this.props.class %}
{% for class in this.props['class'] %}
{% if class starts with 'c-bolt-' == false %}
{% set outer_classes = outer_classes|merge([class]) %}
{% endif %}
Expand Down
Loading

0 comments on commit 1440ccd

Please sign in to comment.