Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search): ES-466 Facets with & symbol works now #1654

Merged
merged 1 commit into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions templates/components/faceted-search/facets/hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
class="accordion-navigation toggleLink {{#unless ../start_collapsed }} is-open {{/unless}}"
role="button"
data-collapsible="#facetedSearch-content--{{hyphenate facet }}">
data-collapsible="#facetedSearch-content--{{#replace '&' (hyphenate facet) }}{{/replace}}">
Copy link
Contributor

Choose a reason for hiding this comment

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

I really don't like the idea of doing special characters replaces at the handlebars level. Today we are doing & tomorrow it is going to be some other special characters.

We should either strip it or escape it at the backend level. Right now

Copy link
Contributor

Choose a reason for hiding this comment

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

You can't escape & to be placed in a fragment. There are no other special characters like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are just doing a replace for & in the string for the fragment can't we do that on the backend itself ?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have two variables we can key this on, unfortunately.

<h5 class="accordion-title">
{{ title }}
</h5>
Expand All @@ -21,8 +21,8 @@ <h5 class="accordion-title">
</div>
</div>

<div id="facetedSearch-content--{{hyphenate facet }}" class="accordion-content {{#unless ../start_collapsed }} is-open {{/unless}}">
<ul id="facetedSearch-navList--{{hyphenate facet }}" class="navList" data-facet="{{facet}}" data-has-more-results="{{ has_more_results }}">
<div id="facetedSearch-content--{{#replace '&' (hyphenate facet) }}{{/replace}}" class="accordion-content {{#unless ../start_collapsed }} is-open {{/unless}}">
<ul id="facetedSearch-navList--{{#replace '&' (hyphenate facet) }}{{/replace}}" class="navList" data-facet="{{facet}}" data-has-more-results="{{ has_more_results }}">
{{#each items}}
<li class="navList-item">
<a
Expand All @@ -46,7 +46,7 @@ <h5 class="accordion-title">
</ul>

{{#if show_more_toggle}}
<a href="#facetedSearch-navList--{{hyphenate facet }}" role="button" class="toggleLink">
<a href="#facetedSearch-navList--{{#replace '&' (hyphenate facet) }}{{/replace}}" role="button" class="toggleLink">
<span class="toggleLink-text toggleLink-text--off">{{lang 'search.faceted.show-more'}}</span>
</a>
{{/if}}
Expand Down
8 changes: 4 additions & 4 deletions templates/components/faceted-search/facets/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
class="accordion-navigation toggleLink {{#unless ../start_collapsed }} is-open {{/unless}}"
role="button"
data-collapsible="#facetedSearch-content--{{hyphenate facet }}">
data-collapsible="#facetedSearch-content--{{#replace '&' (hyphenate facet) }}{{/replace}}">
<h5 class="accordion-title">
{{ title }}
</h5>
Expand All @@ -21,8 +21,8 @@ <h5 class="accordion-title">
</div>
</div>

<div id="facetedSearch-content--{{hyphenate facet }}" class="accordion-content {{#unless ../start_collapsed }} is-open {{/unless}}">
<ul id="facetedSearch-navList--{{hyphenate facet }}" data-facet="{{facet}}" class="navList" data-has-more-results="{{ has_more_results }}">
<div id="facetedSearch-content--{{#replace '&' (hyphenate facet) }}{{/replace}}" class="accordion-content {{#unless ../start_collapsed }} is-open {{/unless}}">
<ul id="facetedSearch-navList--{{#replace '&' (hyphenate facet) }}{{/replace}}" data-facet="{{facet}}" class="navList" data-has-more-results="{{ has_more_results }}">
{{#each items}}
<li class="navList-item">
<a
Expand All @@ -46,7 +46,7 @@ <h5 class="accordion-title">
</ul>

{{#if show_more_toggle}}
<a href="#facetedSearch-navList--{{hyphenate facet }}" role="button" class="toggleLink">
<a href="#facetedSearch-navList--{{#replace '&' (hyphenate facet) }}{{/replace}}" role="button" class="toggleLink">
<span class="toggleLink-text toggleLink-text--off">{{lang 'search.faceted.show-more'}}</span>
</a>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/faceted-search/show-more-facets.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="facet-quick-heading">
data-id="{{ id }}"
data-faceted-search-facet
>
{{title}}
{{{title}}}
{{#if ../show_product_counts}}
{{#if count}}
<span>({{count}})</span>
Expand Down