Skip to content

Commit 025651a

Browse files
committed
Move tab filters to search form
Why these changes are being introduced: UXWS would like the search tabs to display at the bottom of the header, below the search form. Relevant ticket(s): * [USE-147](https://mitlibraries.atlassian.net/browse/USE-147) How this addresses that need: This moves the tabs to a partial, which is then rendered in the search form if results are present. No additional conditional logic is required, because the form itself is rendered only if the GeoData feature is not enabled. Side effects of this change: None.
1 parent 2a81cec commit 025651a

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

app/assets/stylesheets/partials/_search.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,7 @@
192192
margin: 2rem 0;
193193
text-align: center;
194194
}
195+
196+
.tab-link {
197+
color: #fff;
198+
}

app/views/search/_form.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@
2727
</aside>
2828
<% end %>
2929

30+
<%= render partial: 'search/source_tabs' if @results.present? %>
31+
3032
<%= javascript_include_tag "search_form" %>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- Tab Navigation -->
2+
<div id="tabs" class="tab-navigation top-space">
3+
<%= link_to "Primo", results_path(params.permit(:q, :per_page, :page).merge(tab: 'primo')),
4+
class: "tab-link #{'active' if @active_tab == 'primo'}",
5+
data: { turbo_frame: "search-results", turbo_action: "advance" } %>
6+
<%= link_to "TIMDEX", results_path(params.permit(:q, :per_page, :page).merge(tab: 'timdex')),
7+
class: "tab-link #{'active' if @active_tab == 'timdex'}",
8+
data: { turbo_frame: "search-results", turbo_action: "advance" } %>
9+
</div>
10+

app/views/search/results.html.erb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@
1212

1313
<%= render(partial: 'shared/error', collection: @errors) %>
1414

15-
<!-- Tab Navigation -->
16-
<div id="tabs" class="tab-navigation top-space">
17-
<%= link_to "Primo", results_path(params.permit(:q, :per_page, :page).merge(tab: 'primo')),
18-
class: "tab-link #{'active' if @active_tab == 'primo'}",
19-
data: { turbo_frame: "search-results", turbo_action: "advance" } %>
20-
<%= link_to "TIMDEX", results_path(params.permit(:q, :per_page, :page).merge(tab: 'timdex')),
21-
class: "tab-link #{'active' if @active_tab == 'timdex'}",
22-
data: { turbo_frame: "search-results", turbo_action: "advance" } %>
23-
</div>
24-
2515
<%= render(partial: 'trigger_tacos') if tacos_enabled? %>
2616

2717
<%= turbo_frame_tag "search-results" do %>

0 commit comments

Comments
 (0)