Skip to content

Commit 0fe51e9

Browse files
Update conditional when rendering search tabs
** Why are these changes being introduced: Currently, if the initial DOM rendering is done in a condition where there are no search results, the UI doesn't not include tabs to change to a different set of results - which prevents the user from potentially finding results that were initially excluded. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/use-172 ** How does this address that need: This updates the conditional to look for the presence of a query term, rather than the presence of results. This allows us to continue to hide the tabs on initial rendering, prior to a search being done, but should mean that the tabs are shown in all conditions after a search. ** Document any side effects to this change: There shouldn't be - the USE application only has a single search field, so looking for params[:q] should be sufficient to detect a search. GeoData uses other fields, but it relies on different partials and doesn't use tabbed results anyway. Ultimately I could see a helper method for "is there a search?", which we get close to with the existing readable_param method, but I don't want to poke this bear until we have a better sense of what a general solution should look like.
1 parent 77970ca commit 0fe51e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/views/search/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
</aside>
3232
<% end %>
3333

34-
<%= render partial: 'search/source_tabs' if @results.present? %>
34+
<%= render partial: 'search/source_tabs' if params[:q].present? %>
3535

3636
<%= javascript_include_tag "search_form" %>

0 commit comments

Comments
 (0)