|
1 | 1 | <div class="search-container">
|
2 | 2 | <% if admin.searchable? %>
|
3 | 3 | <div class="searchbox">
|
4 |
| - <%= form_tag admin.path, method: :get do %> |
| 4 | + <%= form_tag admin.path, method: :get, data: { turbo_frame: "main" } do %> |
5 | 5 | <div class="input-group">
|
6 | 6 | <%= label_tag :q, icon("fas fa-search"), class: "input-group-text" %>
|
7 | 7 |
|
8 | 8 | <%= search_field_tag :q, params[:q], class: "form-control", autocomplete: "off", placeholder: admin.t("search.placeholder", default: "Search") %>
|
9 | 9 |
|
10 |
| - <%= link_to icon("fas fa-times"), admin.path, class: "btn btn-clear-search" if params[:q].present? %> |
| 10 | + <%= link_to icon("fas fa-times"), admin.path, class: "btn btn-clear-search", data: { turbo_frame: "main" } if params[:q].present? %> |
11 | 11 | </div>
|
12 | 12 | <% end %>
|
13 | 13 | </div>
|
14 | 14 | <% end %>
|
15 | 15 |
|
16 | 16 | <% if admin.filterable? %>
|
17 | 17 | <div class="search-filters">
|
18 |
| - <%= form_for admin.filters, as: :f, url: admin.path, method: :get, builder: Trestle::Form::Builder, html: { id: nil, class: nil } do |f| %> |
| 18 | + <%= form_for admin.filters, as: :f, url: admin.path, method: :get, builder: Trestle::Form::Builder, html: { id: nil, class: nil, data: { turbo_frame: "main" } } do |f| %> |
19 | 19 | <% persistent_params.each do |k, v| %>
|
20 | 20 | <%= hidden_field_tag k, v unless k == "f" %>
|
21 | 21 | <% end %>
|
|
28 | 28 | <% end %>
|
29 | 29 |
|
30 | 30 | <%= f.submit admin.t("search.filter", default: "Filter"), class: "btn btn-info w-100" %>
|
31 |
| - <%= link_to admin.t("search.reset_filters", default: "Reset Filters"), persistent_params.except(:f), class: "btn btn-light btn-sm w-100 mt-2" if admin.filters.active(params).any? %> |
| 31 | + |
| 32 | + <% if admin.filters.active(params).any? %> |
| 33 | + <%= link_to admin.t("search.reset_filters", default: "Reset Filters"), persistent_params.except(:f), class: "btn btn-light btn-sm w-100 mt-2", data: { turbo_frame: "main" } %> |
| 34 | + <% end %> |
32 | 35 | </template>
|
33 | 36 | <% end %>
|
34 | 37 | </div>
|
|
0 commit comments