Merge remote-tracking branch 'parent/main' into upstream-20231204
This commit is contained in:
commit
94c2396a34
179 changed files with 1036 additions and 775 deletions
12
app/helpers/admin/account_actions_helper.rb
Normal file
12
app/helpers/admin/account_actions_helper.rb
Normal file
|
@ -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
|
19
app/helpers/admin/accounts_helper.rb
Normal file
19
app/helpers/admin/accounts_helper.rb
Normal file
|
@ -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
|
12
app/helpers/admin/ip_blocks_helper.rb
Normal file
12
app/helpers/admin/ip_blocks_helper.rb
Normal file
|
@ -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
|
24
app/helpers/admin/roles_helper.rb
Normal file
24
app/helpers/admin/roles_helper.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module RolesHelper
|
||||
def privilege_label(privilege)
|
||||
safe_join(
|
||||
[
|
||||
t("admin.roles.privileges.#{privilege}"),
|
||||
content_tag(:span, t("admin.roles.privileges.#{privilege}_description"), class: 'hint'),
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
def disable_permissions?(permissions)
|
||||
permissions.filter { |privilege| role_flag_value(privilege).zero? }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def role_flag_value(privilege)
|
||||
UserRole::FLAGS[privilege] & current_user.role.computed_permissions
|
||||
end
|
||||
end
|
||||
end
|
15
app/helpers/admin/settings/discovery_helper.rb
Normal file
15
app/helpers/admin/settings/discovery_helper.rb
Normal file
|
@ -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
|
12
app/helpers/filters_helper.rb
Normal file
12
app/helpers/filters_helper.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module FiltersHelper
|
||||
def filter_action_label(action)
|
||||
safe_join(
|
||||
[
|
||||
t("simple_form.labels.filters.actions.#{action}"),
|
||||
content_tag(:span, t("simple_form.hints.filters.actions.#{action}"), class: 'hint'),
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue