Skip to content

Commit

Permalink
Fixes #1228 - Add the .filterLabel template to a file soy separate
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemsteles committed Dec 6, 2018
1 parent 0f3d467 commit 5a74e70
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/clay-management-toolbar/demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ <h2>With filter labels</h2>
label: 'Filter 2',
},
{
label: 'Category: Label 3',
label: 'Category: <strong>Label 3</strong>',
}
]

Expand Down
33 changes: 33 additions & 0 deletions packages/clay-management-toolbar/src/ClayFilterLabel.soy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{namespace ClayFilterLabel}

{template .render}
{@param label: html|string}
{@param spritemap: string}
{@param? _handleFilterLabelCloseClicked: any}
{@param? closeable: bool}
{@param? expand: bool}

{let $elementClasses kind="text"}
tbar-item
{if $expand}
{sp}tbar-item-expand
{/if}
{/let}

<li class="{$elementClasses}">
<div class="tbar-section">
{call ClayLabel.render}
{param closeable: $closeable /}
{param elementClasses: 'component-label tbar-label' /}
{param events: ['close': $_handleFilterLabelCloseClicked] /}
{param label kind="html"}
<div class="label-section">{$label}</div>
{/param}

{param ref: 'label' /}
{param spritemap: $spritemap /}
{param style: false /}
{/call}
</div>
</li>
{/template}
1 change: 1 addition & 0 deletions packages/clay-management-toolbar/src/ClayResultsBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'clay-button';
import 'clay-label';
import 'clay-link';
import './ClayFilterLabel.soy.js';
import {Config} from 'metal-state';
import ClayComponent from 'clay-component';
import defineWebComponent from 'metal-web-component';
Expand Down
40 changes: 2 additions & 38 deletions packages/clay-management-toolbar/src/ClayResultsBar.soy
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,6 @@
</li>
{/template}

/**
*
*/
{template .filterLabel}
{@param index: number}
{@param label: html|string}
{@param spritemap: string}
{@param? _handleFilterLabelCloseClicked: any}
{@param? closeable: bool}
{@param? expand: bool}

{let $elementClasses kind="text"}
tbar-item
{if $expand}
{sp}tbar-item-expand
{/if}
{/let}

<li class="{$elementClasses}">
<div class="tbar-section">
{call ClayLabel.render}
{param closeable: $closeable /}
{param elementClasses: 'component-label tbar-label' /}
{param events: ['close': $_handleFilterLabelCloseClicked] /}
{param label kind="html"}
<div class="label-section">{$label}</div>
{/param}

{param ref: 'label' + $index /}
{param spritemap: $spritemap /}
{param style: false /}
{/call}
</div>
</li>
{/template}

/**
* This renders the list of filter labels
*/
Expand All @@ -125,12 +89,12 @@
{@param? _handleFilterLabelCloseClicked: any}

{foreach $filterLabel in $filterLabels}
{call .filterLabel}
{call ClayFilterLabel.render}
{param _handleFilterLabelCloseClicked: $_handleFilterLabelCloseClicked /}
{param closeable: $filterLabel.closeable ?: true /}
{param expand: isLast($filterLabel) /}
{param index: index($filterLabel) /}
{param label: $filterLabel.label /}
{param ref: 'label' + index($filterLabel) /}
{param spritemap: $spritemap /}
{/call}
{/foreach}
Expand Down

1 comment on commit 5a74e70

@4lejandrito
Copy link
Member

Choose a reason for hiding this comment

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

Awesome! Thanks @matuzalemsteles & @carloslancha.

Please sign in to comment.