Skip to content

Commit

Permalink
Retain persistent params when performing searches
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed Sep 18, 2024
1 parent efa90f7 commit 03a64ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/views/trestle/search/_search.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<div class="searchbox">
<%= form_tag admin.path, method: :get, data: { turbo_frame: "main" } do %>
<%= serialize_persistent_params except: :q %>

<div class="input-group">
<%= label_tag :q, icon("fas fa-search"), class: "input-group-text" %>
<%= search_field_tag :q, params[:q], class: "form-control", autocomplete: "off", placeholder: admin.t("search.placeholder", default: "Search") %>
<%= link_to icon("fas fa-times"), admin.path, class: "btn btn-clear-search", data: { turbo_frame: "main" } if params[:q].present? %>
<%= link_to icon("fas fa-times"), admin.path(nil, persistent_params.except(:q)), class: "btn btn-clear-search", data: { turbo_frame: "main" } if params[:q].present? %>
</div>
<% end %>
</div>

0 comments on commit 03a64ae

Please sign in to comment.