mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-23 06:28:59 +00:00
Add date_range
view helper (#32187)
This commit is contained in:
parent
e13453aec4
commit
bdceb1dacf
|
@ -18,6 +18,11 @@ module Admin::DashboardHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def date_range(range)
|
||||||
|
[l(range.first), l(range.last)]
|
||||||
|
.join(' - ')
|
||||||
|
end
|
||||||
|
|
||||||
def relevant_account_timestamp(account)
|
def relevant_account_timestamp(account)
|
||||||
timestamp, exact = if account.user_current_sign_in_at && account.user_current_sign_in_at < 24.hours.ago
|
timestamp, exact = if account.user_current_sign_in_at && account.user_current_sign_in_at < 24.hours.ago
|
||||||
[account.user_current_sign_in_at, true]
|
[account.user_current_sign_in_at, true]
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
= t('admin.dashboard.title')
|
= t('admin.dashboard.title')
|
||||||
|
|
||||||
- content_for :heading_actions do
|
- content_for :heading_actions do
|
||||||
= l(@time_period.first)
|
= date_range(@time_period)
|
||||||
= ' - '
|
|
||||||
= l(@time_period.last)
|
|
||||||
|
|
||||||
- unless @system_checks.empty?
|
- unless @system_checks.empty?
|
||||||
.flash-message-stack
|
.flash-message-stack
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
- if current_user.can?(:view_dashboard)
|
- if current_user.can?(:view_dashboard)
|
||||||
- content_for :heading_actions do
|
- content_for :heading_actions do
|
||||||
= l(@time_period.first)
|
= date_range(@time_period)
|
||||||
= ' - '
|
|
||||||
= l(@time_period.last)
|
|
||||||
|
|
||||||
- if @instance.persisted?
|
- if @instance.persisted?
|
||||||
= render 'dashboard', instance_domain: @instance.domain, period_end_at: @time_period.last, period_start_at: @time_period.first
|
= render 'dashboard', instance_domain: @instance.domain, period_end_at: @time_period.last, period_start_at: @time_period.first
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
- content_for :heading_actions do
|
- content_for :heading_actions do
|
||||||
- if current_user.can?(:view_dashboard)
|
- if current_user.can?(:view_dashboard)
|
||||||
.time-period
|
.time-period
|
||||||
= l(@time_period.first)
|
= date_range(@time_period)
|
||||||
= ' - '
|
|
||||||
= l(@time_period.last)
|
|
||||||
|
|
||||||
= link_to t('admin.tags.open'), tag_url(@tag), class: 'button', target: '_blank', rel: 'noopener noreferrer'
|
= link_to t('admin.tags.open'), tag_url(@tag), class: 'button', target: '_blank', rel: 'noopener noreferrer'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue