fecgov / fec-cms

The content management system (CMS) for the new Federal Election Commission website.
https://www.fec.gov
Other
93 stars 38 forks source link

Document highlights not displaying for MURs and ADRs in global legal search #6334

Closed patphongs closed 1 month ago

patphongs commented 3 months ago

Summary

What we're after: When using the global legal keyword search, MURs and ADRs are not showing document highlights. This needs to be fixed.

This bug is related to the logic change in the MUR and ADR templates to only show documents when a keyword and/or document type is selected. The global legal keyword search needs to always display document highlights when present.

Related issues

List any relevant related issue(s)

Completion criteria

johnnyporkchops commented 3 months ago

@pat, Maybe we could set a boolean condition in the MUR and ADR sections of global search results template that renders a simpler layout for highlights -- only when the MUR or ADR partial is included in that template (see screenshot)

templates/legal-search-results.jinja

                        {% with murs = results[category], nested_in_global_search=true %}
                        {% include 'partials/legal-search-results-mur.jinja' %}
                        {% endwith %}

partials/legal-search-results-mur.jinja

     {%  if  nested_in_global_search %} 
         <div class="t-sans u-padding--top">Keyword match:</div>
          {% for document in mur.documents %}
                 {% set query_highlight = mur.document_highlights[loop.index0 | string]%}
                 {% if(query_highlight) %}
                    {# show only first document highlight result #}
                    <ul>
                        <li class="post--icon t-serif t-italic u-padding--top--med">
                          &#8230;{{ query_highlight[0] | safe }}&#8230;
                        </li>
                    </ul>
                {% endif %}
       {% endfor %}
    {% endif %}

 # (this could also be an `if/else`,  with existing document logic wrapped in the else)   
Screenshot 2024-07-28 at 2 42 25 AM