Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add post count to Search results page #972

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app/views/search/search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@
</div>

<% unless @posts.nil? %>
<div class="button-list is-gutterless has-float-right">
<%= link_to 'Relevance', query_url(sort: 'relevance'),
class: "button is-outlined is-muted #{params[:sort] == 'relevance' || params[:sort].nil? ? 'is-active' : ''}" %>
<%= link_to 'Score', query_url(sort: 'score'), class: "button is-outlined is-muted #{params[:sort] == 'score' ? 'is-active' : ''}" %>
<%= link_to 'Age', query_url(sort: 'age'), class: "button is-outlined is-muted #{params[:sort] == 'age' ? 'is-active' : ''}" %>
<% post_count = @posts.count %>
<div class="has-color-tertiary-500 flex-row jc-sb ai-c" title="<%= post_count %>">
<div>
<%= short_number_to_human post_count, precision: 1, significant: false %>
<%= 'post'.pluralize(post_count) %>
</div>
<div class="button-list is-gutterless">
<%= link_to 'Relevance', query_url(sort: 'relevance'), class: "button is-outlined is-muted #{params[:sort] == 'relevance' || params[:sort].nil? ? 'is-active' : ''}" %>
<%= link_to 'Score', query_url(sort: 'score'), class: "button is-outlined is-muted #{params[:sort] == 'score' ? 'is-active' : ''}" %>
<%= link_to 'Age', query_url(sort: 'age'), class: "button is-outlined is-muted #{params[:sort] == 'age' ? 'is-active' : ''}" %>
</div>
</div>
<div class="has-clear-clear">&nbsp;</div>

Expand Down