|
2 | 2 |
|
3 | 3 | <h1>Search</h1> |
4 | 4 |
|
5 | | -<%= render 'widget' %> |
6 | | - |
7 | | -<% unless @posts.nil? %> |
8 | | - <% post_count = @posts.count %> |
9 | | - <div class="has-color-tertiary-500 flex-row jc-sb ai-c"> |
10 | | - <span title="<%= post_count %> posts"> |
11 | | - <%= short_number_to_human post_count, precision: 1, significant: false %> |
12 | | - <%= 'post'.pluralize(post_count) %> |
13 | | - </span> |
14 | | - <div class="button-list is-gutterless has-margin-2"> |
15 | | - <%= link_to 'Relevance', request.params.merge(sort: 'relevance'), class: "button is-outlined is-muted #{params[:sort] == 'relevance' || params[:sort].nil? ? 'is-active' : ''}", |
16 | | - role: 'button', 'aria-label': 'Sort by relevance' %> |
17 | | - <%= link_to 'Activity', request.params.merge(sort: 'activity'), class: "button is-outlined is-muted #{params[:sort] == 'activity' ? 'is-active' : ''}", |
18 | | - role: 'button', 'aria-label': 'Sort by activity' %> |
19 | | - <%= link_to 'Age', request.params.merge(sort: 'age'), class: "button is-outlined is-muted #{params[:sort] == 'age' ? 'is-active' : ''}", |
20 | | - role: 'button', 'aria-label': 'Sort by age' %> |
21 | | - <%= link_to 'Score', request.params.merge(sort: 'score'), class: "button is-outlined is-muted #{params[:sort] == 'score' ? 'is-active' : ''}", |
22 | | - role: 'button', 'aria-label': 'Sort by score' %> |
| 5 | +<%= form_tag search_path, method: :get, role: 'search' do %> |
| 6 | + <%= render 'search/widget' %> |
| 7 | + |
| 8 | + <% unless @posts.nil? %> |
| 9 | + <% post_count = @posts.count %> |
| 10 | + <div class="search-sorting has-color-tertiary-500"> |
| 11 | + <span title="<%= post_count %> posts"> |
| 12 | + <%= short_number_to_human post_count, precision: 1, significant: false %> |
| 13 | + <%= 'post'.pluralize(post_count) %> |
| 14 | + </span> |
| 15 | + <div class="search-sorting-types button-list is-gutterless"> |
| 16 | + <%= link_to 'Relevance', |
| 17 | + request.params.merge(sort: 'relevance'), |
| 18 | + class: "button is-outlined is-muted #{'is-active' if params[:sort] == 'relevance' || params[:sort].nil?}", |
| 19 | + role: 'button', 'aria-label': 'Sort by relevance' %> |
| 20 | + <%= link_to 'Activity', |
| 21 | + request.params.merge(sort: 'activity'), |
| 22 | + class: "button is-outlined is-muted #{'is-active' if params[:sort] == 'activity'}", |
| 23 | + role: 'button', 'aria-label': 'Sort by activity' %> |
| 24 | + <%= link_to 'Age', |
| 25 | + request.params.merge(sort: 'age'), |
| 26 | + class: "button is-outlined is-muted #{'is-active' if params[:sort] == 'age'}", |
| 27 | + role: 'button', 'aria-label': 'Sort by age' %> |
| 28 | + <%= link_to 'Score', |
| 29 | + request.params.merge(sort: 'score'), |
| 30 | + class: "button is-outlined is-muted #{'is-active' if params[:sort] == 'score'}", |
| 31 | + role: 'button', 'aria-label': 'Sort by score' %> |
| 32 | + </div> |
23 | 33 | </div> |
24 | | - </div> |
25 | 34 |
|
26 | | - <div class="has-clear-clear"> </div> |
| 35 | + <details class="search-filters"> |
| 36 | + <summary>Filters</summary> |
| 37 | + <%= render 'search/filters' %> |
| 38 | + </details> |
27 | 39 |
|
28 | | - <% if @posts.size == 0 %> |
29 | | - <p class="has-color-tertiary"><em>No results for <strong><%= params[:search] %></strong>. Try using a different search term.</em></p> |
30 | | - <% end %> |
| 40 | + <div class="has-clear-clear"> </div> |
31 | 41 |
|
32 | | - <div class="item-list has-border-top-width-1 has-border-top-style-solid has-border-color-tertiary-050"> |
33 | | - <% @posts.each do |post| %> |
34 | | - <% next if post.nil? %> |
35 | | - <%= render 'posts/type_agnostic', post: post, show_type_tag: true, show_category_tag: true %> |
| 42 | + <% if @posts.size == 0 %> |
| 43 | + <p class="has-color-tertiary"> |
| 44 | + <em>No results for <strong><%= params[:search] %></strong>. Try using a different search term.</em> |
| 45 | + </p> |
36 | 46 | <% end %> |
37 | | - </div> |
38 | | -<% end %> |
39 | 47 |
|
40 | | -<% unless @posts.nil? %> |
41 | | - <%= will_paginate @posts, renderer: BootstrapPagination::Rails %> |
| 48 | + <div class="item-list has-border-top-width-1 has-border-top-style-solid has-border-color-tertiary-050"> |
| 49 | + <% @posts.each do |post| %> |
| 50 | + <% next if post.nil? %> |
| 51 | + <%= render 'posts/type_agnostic', post: post, show_type_tag: true, show_category_tag: true %> |
| 52 | + <% end %> |
| 53 | + </div> |
| 54 | + |
| 55 | + <%= will_paginate @posts, renderer: BootstrapPagination::Rails %> |
| 56 | + <% end %> |
42 | 57 | <% end %> |
0 commit comments