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

🐛 Return early for no snippets #260

Merged
merged 1 commit into from
Jul 13, 2023
Merged

Commits on Jul 13, 2023

  1. 🐛 Return early for no snippets

    This commit fixes a bug where the `render_snippet` method would return
    `... ...` when there are no snippets.  This way, in the main
    application's `app/views/catalog/_index_list_default.html.erb` file, we
    can do something like:
    
    ```erb
    <% index_fields(document).each do |field_name, field| -%>
      <% if should_render_index_field? document, field %>
          <div class="search-index-metadata-group metadata-<%= field_name %>">
            <% field_value = doc_presenter.field_value field_name %>
            <%# Don't show the snippets field if it's empty %>
            <% next if field_value.blank? %>
            <dt><%= render_index_field_label document, field: field_name %></dt>
            <dd><%= field_value %></dd>
          </div>
      <% end %>
    <% end %>
    ```
    
    This way the field label doesn't show up if there are no snippets.
    kirkkwang committed Jul 13, 2023
    Configuration menu
    Copy the full SHA
    ec0b960 View commit details
    Browse the repository at this point in the history