Skip to content

Commit

Permalink
Merge pull request #1180 from Metro-Records/hcg/search-fix
Browse files Browse the repository at this point in the history
Fix duplicate search filters
  • Loading branch information
hancush authored Dec 4, 2024
2 parents 1944bc9 + 6884469 commit 32ea9dc
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions lametro/templates/search/_search_filter.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load extras %}
{% load lametro_extras %}

{% if facet_label != 'Controlling Body' %}
{% if facet_label != 'Controlling Body' and item_list|length > 0 %}

<div class="accordion-item">
<h3 class="accordion-header">
Expand All @@ -21,40 +21,29 @@ <h3 class="accordion-header">
<div id="collapse_{{facet_name}}" class="accordion-collapse collapse">
<div class="accordion-body">
<ul class="search-facet-list">
{% if facet_name in 'topics,lines_and_ways,phase,bill_type,project,metro_location,geo_admin_location,significant_date,motion_by,plan_program_policy' %}
{% if facet_name != 'sponsorships' %}

{% include 'search/_ordered_search_filter_items.html' %}

{% elif facet_name == 'sponsorships' %}
{% for name, count in facets.fields.sponsorships %}
{% else %}

{% for name, count in facets.fields.sponsorships %}
{% if count %}
<li class="small d-flex">
<li class="small d-flex">
<div class="skinny-list">
{% if name in selected_facets.sponsorships %}
<div class="skinny-list">
<a href="#" class="filter-value" data-param="sponsorships_exact:{{name}}" title="{{ name|title }}">
<strong>{{ name | title }}</strong>
</a>
<a href="#" class="remove-filter-value btn btn-primary btn-sm" data-param="{{facet_name}}_exact:{{name}}" aria-label="Remove {{name}} filter">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
</div>
<strong>{{ name | title }}</strong>
<a href="#" class="remove-filter-value btn btn-primary btn-sm" data-param="{{facet_name}}_exact:{{name}}" aria-label="Remove {{name}} filter">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
{% else %}
<a href="#" class="filter-value" data-param="sponsorships_exact:{{name}}" title="{{ name|title }}">
{{ name | title }}
</a>
{% endif %}

<span class="badge badge-facet ms-auto">{{ count }}</span>

</li>
{% endif%}

{% endfor %}
{% else %}

{% for name, count in item_list %}
{% if count %}
{% include 'search/_ordered_search_filter_items.html' %}
</div>
<span class="badge badge-facet ms-auto">{{ count }}</span>
</li>
{% endif %}
{% endfor %}

Expand Down

0 comments on commit 32ea9dc

Please sign in to comment.