mirror of https://github.com/Siphonay/mastodon
Change icons of features on admin dashboard to remove bias (#10366)
Red crosses implied that it was bad/unexpected that certain features were not enabled. In reality, they are options, so showing a green or grey power-off icon is more appropriate. Add status of timeline preview as well Fix sample accounts changing too frequently due to wrong query Sample accounts are intended to be sorted by popularity
This commit is contained in:
parent
9745de883b
commit
e117964325
|
@ -29,6 +29,7 @@ module Admin
|
||||||
@hidden_service = ENV['ALLOW_ACCESS_TO_HIDDEN_SERVICE'] == 'true'
|
@hidden_service = ENV['ALLOW_ACCESS_TO_HIDDEN_SERVICE'] == 'true'
|
||||||
@trending_hashtags = TrendingTags.get(7)
|
@trending_hashtags = TrendingTags.get(7)
|
||||||
@profile_directory = Setting.profile_directory
|
@profile_directory = Setting.profile_directory
|
||||||
|
@timeline_preview = Setting.timeline_preview
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -32,7 +32,7 @@ class DirectoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_accounts
|
def set_accounts
|
||||||
@accounts = Account.discoverable.page(params[:page]).per(40).tap do |query|
|
@accounts = Account.discoverable.by_recent_status.page(params[:page]).per(40).tap do |query|
|
||||||
query.merge!(Account.tagged_with(@tag.id)) if @tag
|
query.merge!(Account.tagged_with(@tag.id)) if @tag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Admin::DashboardHelper
|
||||||
|
def feature_hint(feature, enabled)
|
||||||
|
indicator = safe_join([enabled ? t('simple_form.yes') : t('simple_form.no'), fa_icon('power-off fw')], ' ')
|
||||||
|
class_names = enabled ? 'pull-right positive-hint' : 'pull-right neutral-hint'
|
||||||
|
|
||||||
|
safe_join([feature, content_tag(:span, indicator, class: class_names)])
|
||||||
|
end
|
||||||
|
end
|
|
@ -220,6 +220,11 @@ $content-width: 840px;
|
||||||
color: $error-value-color;
|
color: $error-value-color;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.neutral-hint {
|
||||||
|
color: $dark-text-color;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: $no-columns-breakpoint) {
|
@media screen and (max-width: $no-columns-breakpoint) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ class Account < ApplicationRecord
|
||||||
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
|
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
|
||||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||||
scope :searchable, -> { without_suspended.where(moved_to_account_id: nil) }
|
scope :searchable, -> { without_suspended.where(moved_to_account_id: nil) }
|
||||||
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)).by_recent_status }
|
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)) }
|
||||||
scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) }
|
scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) }
|
||||||
scope :by_recent_status, -> { order(Arel.sql('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc')) }
|
scope :by_recent_status, -> { order(Arel.sql('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc')) }
|
||||||
scope :popular, -> { order('account_stats.followers_count desc') }
|
scope :popular, -> { order('account_stats.followers_count desc') }
|
||||||
|
|
|
@ -40,35 +40,17 @@
|
||||||
%h4= t 'admin.dashboard.features'
|
%h4= t 'admin.dashboard.features'
|
||||||
%ul
|
%ul
|
||||||
%li
|
%li
|
||||||
= link_to t('admin.dashboard.feature_registrations'), edit_admin_settings_path
|
= feature_hint(link_to(t('admin.dashboard.feature_registrations'), edit_admin_settings_path), @registrations_enabled)
|
||||||
- if @registrations_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= link_to t('admin.dashboard.feature_invites'), edit_admin_settings_path
|
= feature_hint(link_to(t('admin.dashboard.feature_invites'), edit_admin_settings_path), @invites_enabled)
|
||||||
- if @invites_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= link_to t('admin.dashboard.feature_deletions'), edit_admin_settings_path
|
= feature_hint(link_to(t('admin.dashboard.feature_deletions'), edit_admin_settings_path), @deletions_enabled)
|
||||||
- if @deletions_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= link_to t('admin.dashboard.feature_profile_directory'), edit_admin_settings_path
|
= feature_hint(link_to(t('admin.dashboard.feature_profile_directory'), edit_admin_settings_path), @profile_directory)
|
||||||
- if @profile_directory
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= link_to t('admin.dashboard.feature_relay'), admin_relays_path
|
= feature_hint(link_to(t('admin.dashboard.feature_timeline_preview'), edit_admin_settings_path), @timeline_preview)
|
||||||
- if @relay_enabled
|
%li
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
= feature_hint(link_to(t('admin.dashboard.feature_relay'), admin_relays_path), @relay_enabled)
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
|
|
||||||
.dashboard__widgets__versions
|
.dashboard__widgets__versions
|
||||||
%div
|
%div
|
||||||
|
@ -103,47 +85,19 @@
|
||||||
%h4= t 'admin.dashboard.config'
|
%h4= t 'admin.dashboard.config'
|
||||||
%ul
|
%ul
|
||||||
%li
|
%li
|
||||||
= t('admin.dashboard.search')
|
= feature_hint(t('admin.dashboard.search'), @search_enabled)
|
||||||
- if @search_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= t('admin.dashboard.single_user_mode')
|
= feature_hint(t('admin.dashboard.single_user_mode'), @single_user_mode)
|
||||||
- if @single_user_mode
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
LDAP
|
= feature_hint('LDAP', @ldap_enabled)
|
||||||
- if @ldap_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
CAS
|
= feature_hint('CAS', @cas_enabled)
|
||||||
- if @cas_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
SAML
|
= feature_hint('SAML', @saml_enabled)
|
||||||
- if @saml_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
PAM
|
= feature_hint('PAM', @pam_enabled)
|
||||||
- if @pam_enabled
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
%li
|
%li
|
||||||
= t 'admin.dashboard.hidden_service'
|
= feature_hint(t('admin.dashboard.hidden_service'), @hidden_service)
|
||||||
- if @hidden_service
|
|
||||||
%span.pull-right.positive-hint= fa_icon 'check fw'
|
|
||||||
- else
|
|
||||||
%span.pull-right.negative-hint= fa_icon 'times fw'
|
|
||||||
|
|
||||||
.dashboard__widgets__trends
|
.dashboard__widgets__trends
|
||||||
%div
|
%div
|
||||||
|
|
|
@ -245,6 +245,7 @@ en:
|
||||||
feature_profile_directory: Profile directory
|
feature_profile_directory: Profile directory
|
||||||
feature_registrations: Registrations
|
feature_registrations: Registrations
|
||||||
feature_relay: Federation relay
|
feature_relay: Federation relay
|
||||||
|
feature_timeline_preview: Timeline preview
|
||||||
features: Features
|
features: Features
|
||||||
hidden_service: Federation with hidden services
|
hidden_service: Federation with hidden services
|
||||||
open_reports: open reports
|
open_reports: open reports
|
||||||
|
|
Loading…
Reference in New Issue