Skip to content

Commit c69c658

Browse files
authored
fix: updated base template to handlebars (#1463)
* fix: we need to update that template to handlebars the previous syntax might have been fine for mustache, but we should both explicitly use the block helpers as well as mind the context of variables within each helpers. * chore: additionally updating the template type from mustache to handlebars; wouldn't hurt … * Update index.html * fix: this ones actually an iteration * Revert "fix: this ones actually an iteration" This reverts commit 7def87d. * fix: we actually need to the previous declaration here * chore: previous formatting * chore: changed my mind again …
1 parent 566485a commit c69c658

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

packages/uikit-workshop/src/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<pl-layout></pl-layout>
2727

2828
<!-- the template for the modal slider -->
29-
<script type="text/mustache" class="pl-js-panel-template-base">
29+
<script type="text/x-handlebars-template" class="pl-js-panel-template-base">
3030
${require('./partials/base-template.html') }
3131
</script>
3232

packages/uikit-workshop/src/html/partials/base-template.html

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,135 @@
11
<!-- description, etc. -->
2-
{{# descBlockExists }}
2+
{{#if descBlockExists }}
33

44
<div
55
class="pl-c-pattern-info__panel pl-c-pattern-info__panel--info pl-js-pattern-info"
66
>
7-
{{# isPatternView }}
7+
{{#if isPatternView }}
88
<!-- extra info for modal view -->
99
<div class="pl-c-pattern-info__header">
1010
<ul class="pl-c-breadcrumb">
11-
{{# patternBreadcrumb }}
11+
{{#with patternBreadcrumb }}
1212

1313
<li class="pl-c-breadcrumb__item">{{ patternGroup }}</li>
1414

15-
{{# patternSubgroup }}
15+
{{#if patternSubgroup }}
1616
<li class="pl-c-breadcrumb__item">{{ patternSubgroup }}</li>
17-
{{/ patternSubgroup }} {{/ patternBreadcrumb }}
17+
{{/if }} {{/with }}
1818
</ul>
1919
<!--end pl-c-breadcrumb-->
2020

2121
<h2 class="pl-c-pattern-info__title">
22-
{{ patternName }} {{# patternState }}
22+
{{ patternName }} {{#if patternState }}
2323
<span
2424
class="pl-c-pattern-state pl-c-pattern-state--{{ patternState }}"
2525
title="{{ patternState }}"
2626
></span>
27-
{{/ patternState }}
27+
{{/if }}
2828
</h2>
2929
<!--end pl-c-pattern-info__title-->
3030
</div>
3131
<!--end pl-c-pattern-info__header-->
32-
{{/ isPatternView }} {{# patternDescExists }}
32+
{{/if }} {{#if patternDescExists }}
3333
<div class="pl-c-pattern-info__description pl-c-text-passage">
34-
{{{ patternDesc }}} {{# patternDescAdditions }} {{{ patternDescAdditions }}}
35-
{{/ patternDescAdditions }}
34+
{{{ patternDesc }}} {{#if patternDescAdditions }} {{{ patternDescAdditions
35+
}}} {{/if }}
3636
</div>
3737
<!--end pl-c-pattern-info__description-->
38-
{{/ patternDescExists }} {{# lineageExists }}
38+
{{/if }} {{#if lineageExists }}
3939
<p class="pl-c-lineage pl-js-lineage">
4040
The
4141
<em>{{ patternName }}</em>
42-
pattern contains the following patterns: {{# lineage }}
42+
pattern contains the following patterns: {{#each lineage }}
4343
<a
4444
href="{{ lineagePath }}"
4545
class="pl-c-lineage__link pl-js-lineage-link"
4646
data-patternpartial="{{ lineagePattern }}"
4747
>
48-
{{ lineagePattern }} {{# lineageState }}<span
48+
{{ lineagePattern }} {{#if lineageState }}<span
4949
class="pl-c-pattern-state pl-c-pattern-state--{{ lineageState }}"
5050
title="{{ lineageState }}"
5151
/>
52-
{{/ lineageState }}
52+
{{/if }}
5353
</a>
5454
<!--end pl-c-lineage__link-->
55-
{{# hasComma }}, {{/ hasComma }} {{/ lineage }}
55+
{{#if hasComma }}, {{/if }} {{/each }}
5656
</p>
5757
<!--end pl-c-lineage-->
58-
{{/ lineageExists }} {{# lineageRExists }}
58+
{{/if }} {{#if lineageRExists }}
5959
<p class="pl-c-lineage">
6060
The
6161
<em>{{ patternName }}</em>
62-
pattern is included in the following patterns: {{# lineageR }}
62+
pattern is included in the following patterns: {{#each lineageR }}
6363
<a
6464
href="{{ lineagePath }}"
6565
class="pl-c-lineage__link pl-js-lineage-link"
6666
data-patternpartial="{{ lineagePattern }}"
6767
>
68-
{{ lineagePattern }} {{# lineageState }}<span
68+
{{ lineagePattern }} {{#if lineageState }}<span
6969
class="pl-c-pattern-state pl-c-pattern-state--{{ lineageState }}"
7070
title="{{ lineageState }}"
7171
/>
72-
{{/ lineageState }}
72+
{{/if }}
7373
</a>
7474
<!--end pl-c-lineage__link-->
75-
{{# hasComma }}, {{/ hasComma }} {{/ lineageR }}
75+
{{#if hasComma }}, {{/if }} {{/each }}
7676
</p>
7777
<!--end pl-c-lineage-->
78-
{{/ lineageRExists }} {{# annotationExists }}
78+
{{/if }} {{#if annotationExists }}
7979
<div class="pl-c-annotations pl-c-text-passage pl-js-annotations">
8080
<h2 class="pl-c-annotations__title">Annotations</h2>
8181
<ol class="pl-c-annotations__list">
82-
{{# annotations }}
82+
{{#each annotations }}
8383
<li class="pl-c-annotations__item">
8484
<h3 class="pl-c-annotations__item-title">{{ title }}</h3>
8585

8686
<div class="pl-c-annotations__item-body">{{{ comment }}}</div>
8787
<!--end pl-c-annotations__item-body-->
8888
</li>
8989
<!--end pl-c-annotations__item-->
90-
{{/ annotations }}
90+
{{/each }}
9191
</ol>
9292
<!--end pl-c-annotations__list-->
9393
</div>
9494
<!--end pl-c-annotations-->
95-
{{/ annotationExists }}
95+
{{/if }}
9696
</div>
9797
<!--end pl-c-pattern-info__panel-->
98-
{{/ descBlockExists }}
98+
{{/if }}
9999

100100
<div class="pl-c-pattern-info__panel pl-c-pattern-info__panel--code">
101101
<div id="pl-{{ patternPartial }}-tabs" class="pl-c-tabs pl-js-tabs">
102102
<div class="pl-c-tabs__header">
103103
<ul class="pl-c-tabs__list">
104-
{{# panels }}
104+
{{#each panels }}
105105
<li class="pl-c-tabs__list-item">
106106
<a
107107
class="pl-c-tabs__link pl-js-tab-link"
108-
href="#pl-{{ patternPartial }}-{{ id }}-panel"
109-
id="pl-{{ patternPartial }}-{{ id }}-tab"
110-
data-patternpartial="{{ patternPartial }}"
108+
href="#pl-{{ ../patternPartial }}-{{ id }}-panel"
109+
id="pl-{{ ../patternPartial }}-{{ id }}-tab"
110+
data-patternpartial="{{ ../patternPartial }}"
111111
data-panelid="{{ id }}"
112112
no-smooth-scroll
113113
>{{ name }}</a
114114
>
115115
</li>
116116
<!--end pl-c-tabs__list-item-->
117-
{{/ panels }}
117+
{{/each }}
118118
</ul>
119119
<!--end pl-c-tabs__list-->
120120
</div>
121121
<!--end pl-c-tabs__header-->
122122

123123
<div id="pl-{{ patternPartial }}-panels" class="pl-c-tabs__content">
124-
{{# panels }}
124+
{{#each panels }}
125125
<div
126-
id="pl-{{ patternPartial }}-{{ id }}-panel"
126+
id="pl-{{ ../patternPartial }}-{{ id }}-panel"
127127
class="pl-c-tabs__panel pl-js-tab-panel"
128128
>
129129
<button
130130
class="pl-c-code-copy-btn pl-js-code-copy-btn"
131131
size="small"
132-
data-clipboard-target="#pl-{{ patternPartial }}-{{ id }}-panel code"
132+
data-clipboard-target="#pl-{{ ../patternPartial }}-{{ id }}-panel code"
133133
type="button"
134134
>
135135
<span class="pl-c-code-copy-btn__icon-text">Copy</span>
@@ -166,7 +166,7 @@ <h3 class="pl-c-annotations__item-title">{{ title }}</h3>
166166
{{{ content }}}
167167
</div>
168168
<!--end pl-c-tabs__panel-->
169-
{{/ panels }}
169+
{{/each }}
170170
</div>
171171
<!--end pl-c-tabs__content-->
172172
</div>

0 commit comments

Comments
 (0)