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

Change dashboard to short number notation #11847

Merged
merged 6 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions app/helpers/admin/dashboard_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ def feature_hint(feature, enabled)

safe_join([feature, content_tag(:span, indicator, class: class_names)])
end

def short_number_format(number)
number_to_human number, units: { unit: '', thousand: 'K', million: 'M', billion: 'B' }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Followers count on profile pages already uses short number format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It existed for switching between short and full notation. Match the way you write your profile page.

end
end
16 changes: 8 additions & 8 deletions app/views/admin/dashboard/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
.dashboard__counters
%div
= link_to admin_accounts_url(local: 1, recent: 1) do
.dashboard__counters__num= number_with_delimiter @users_count
.dashboard__counters__num= short_number_format @users_count
.dashboard__counters__label= t 'admin.dashboard.total_users'
%div
%div
.dashboard__counters__num= number_with_delimiter @registrations_week
.dashboard__counters__num= short_number_format @registrations_week
.dashboard__counters__label= t 'admin.dashboard.week_users_new'
%div
%div
.dashboard__counters__num= number_with_delimiter @logins_week
.dashboard__counters__num= short_number_format @logins_week
.dashboard__counters__label= t 'admin.dashboard.week_users_active'
%div
= link_to admin_pending_accounts_path do
.dashboard__counters__num= number_with_delimiter @pending_users_count
.dashboard__counters__num= short_number_format @pending_users_count
.dashboard__counters__label= t 'admin.dashboard.pending_users'
%div
= link_to admin_reports_url do
.dashboard__counters__num= number_with_delimiter @reports_count
.dashboard__counters__num= short_number_format @reports_count
.dashboard__counters__label= t 'admin.dashboard.open_reports'
%div
= link_to admin_tags_path(review: 'pending_review') do
.dashboard__counters__num= number_with_delimiter @pending_tags_count
.dashboard__counters__num= short_number_format @pending_tags_count
.dashboard__counters__label= t 'admin.dashboard.pending_tags'
%div
%div
.dashboard__counters__num= number_with_delimiter @interactions_week
.dashboard__counters__num= short_number_format @interactions_week
.dashboard__counters__label= t 'admin.dashboard.week_interactions'
%div
= link_to sidekiq_url do
.dashboard__counters__num= number_with_delimiter @queue_backlog
.dashboard__counters__num= short_number_format @queue_backlog
.dashboard__counters__label= t 'admin.dashboard.backlog'

.dashboard__widgets
Expand Down