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

added post count to user posts page #1108

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions app/views/users/posts.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@

<h1>Posts by <%= user_link @user %></h1>

<div class="button-list is-gutterless">
<%= link_to 'Score', query_url(sort: 'score'), class: 'button is-muted is-outlined ' + (active_search?('score') ? 'is-active' : ''),
role: 'button', 'aria-label': 'Sort by score' %>
<%= link_to 'Age', query_url(sort: 'age'), class: 'button is-muted is-outlined ' + (active_search?('created_at') ? 'is-active' : ''),
role: 'button', 'aria-label': 'Sort by age' %>
<% post_count = @posts.count %>
<div class="has-color-tertiary-500 category-meta" 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 has-margin-2">
<%= link_to 'Score', query_url(sort: 'score'), class: 'button is-muted is-outlined ' + (active_search?('score') ? 'is-active' : ''),
role: 'button', 'aria-label': 'Sort by score' %>
<%= link_to 'Age', query_url(sort: 'age'), class: 'button is-muted is-outlined ' + (active_search?('created_at') ? 'is-active' : ''),
role: 'button', 'aria-label': 'Sort by age' %>
</div>
</div>

<div class="item-list">
Expand All @@ -19,4 +27,4 @@
<% end %>
</div>

<%= will_paginate @posts, renderer: BootstrapPagination::Rails %>
<%= will_paginate @posts, renderer: BootstrapPagination::Rails %>