Extract helper methods for form label in admin/ area views (#27575)
parent
9b47c5d53c
commit
72b7cd349c
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin::AccountActionsHelper
|
||||
def account_action_type_label(type)
|
||||
safe_join(
|
||||
[
|
||||
I18n.t("simple_form.labels.admin_account_action.types.#{type}"),
|
||||
content_tag(:span, I18n.t("simple_form.hints.admin_account_action.types.#{type}"), class: 'hint'),
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin::AccountsHelper
|
||||
def admin_accounts_moderation_options
|
||||
[
|
||||
[t('admin.accounts.moderation.active'), 'active'],
|
||||
[t('admin.accounts.moderation.silenced'), 'silenced'],
|
||||
[t('admin.accounts.moderation.disabled'), 'disabled'],
|
||||
[t('admin.accounts.moderation.suspended'), 'suspended'],
|
||||
[safe_join([t('admin.accounts.moderation.pending'), "(#{pending_user_count_label})"], ' '), 'pending'],
|
||||
]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pending_user_count_label
|
||||
number_with_delimiter User.pending.count
|
||||
end
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin::IpBlocksHelper
|
||||
def ip_blocks_severity_label(severity)
|
||||
safe_join(
|
||||
[
|
||||
I18n.t("simple_form.labels.ip_block.severities.#{severity}"),
|
||||
content_tag(:span, I18n.t("simple_form.hints.ip_block.severities.#{severity}"), class: 'hint'),
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin::Settings::DiscoveryHelper
|
||||
def discovery_warning_hint_text
|
||||
authorized_fetch_overridden? ? t('admin.settings.security.authorized_fetch_overridden_hint') : nil
|
||||
end
|
||||
|
||||
def discovery_hint_text
|
||||
t('admin.settings.security.authorized_fetch_hint')
|
||||
end
|
||||
|
||||
def discovery_recommended_value
|
||||
authorized_fetch_overridden? ? :overridden : nil
|
||||
end
|
||||
end
|
Loading…
Reference in new issue