Skip to content

Commit

Permalink
Add href to clearResults | Fixes #705
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Lancha committed Mar 13, 2018
1 parent 0b741aa commit 77db829
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
9 changes: 9 additions & 0 deletions packages/clay-management-toolbar/src/ClayManagementToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ ClayManagementToolbar.STATE = {
*/
actionItems: actionItemsValidator,

/**
* Url for clear results link.
* @instance
* @memberof ClayManagementToolbar
* @type {?string|undefined}
* @default undefined
*/
clearResultsHref: Config.string(),

/**
* Name of the content renderer to use template variants.
* @instance
Expand Down
40 changes: 25 additions & 15 deletions packages/clay-management-toolbar/src/ClayManagementToolbar.soy
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
separator: bool,
type: string
]>}
{@param? clearResultsHref: string}
{@param? contentRenderer: string}
{@param? creationMenu: bool|string|[
button: ?,
Expand Down Expand Up @@ -135,12 +136,12 @@
{/if}

{if $searchValue and $totalItems > 0}
{call .resultsBar}
{param _handleClearResultsClick: $_handleClearResultsClick /}
{param disabled: $isActive /}
{param searchValue: $searchValue /}
{param totalItems: $totalItems /}
{/call}
{call .resultsBar}
{param _handleClearResultsClick: $_handleClearResultsClick /}
{param clearResultsHref: $clearResultsHref /}
{param searchValue: $searchValue /}
{param totalItems: $totalItems /}
{/call}
{/if}
</div>
{/template}
Expand Down Expand Up @@ -545,7 +546,7 @@
*/
{template .resultsBar}
{@param? _handleClearResultsClick: any}
{@param? disabled: bool}
{@param? clearResultsHref: string}
{@param? searchValue: string}
{@param? totalItems: number}

Expand All @@ -560,14 +561,23 @@
</div>
</li>
<li class="tbar-item">
{call ClayButton.render}
{param disabled: $disabled /}
{param elementClasses: 'component-link tbar-link' /}
{param events: ['click': $_handleClearResultsClick] /}
{param label: 'Clear' /}
{param ref: 'clearSearch' /}
{param style: 'unstyled' /}
{/call}
{if $clearResultsHref}
{call ClayLink.render}
{param elementClasses: 'component-link tbar-link' /}
{param events: ['click': $_handleClearResultsClick] /}
{param href: $clearResultsHref /}
{param label: 'Clear' /}
{param ref: 'clearSearch' /}
{/call}
{else}
{call ClayButton.render}
{param elementClasses: 'component-link tbar-link' /}
{param events: ['click': $_handleClearResultsClick] /}
{param label: 'Clear' /}
{param ref: 'clearSearch' /}
{param style: 'unstyled' /}
{/call}
{/if}
</li>
</ul>
</div>
Expand Down

0 comments on commit 77db829

Please sign in to comment.