From e11796432514afb49f3d891f805973a37f00fcf1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 26 Mar 2019 01:24:19 +0100 Subject: 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 --- app/helpers/admin/dashboard_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/helpers/admin/dashboard_helper.rb (limited to 'app/helpers/admin') diff --git a/app/helpers/admin/dashboard_helper.rb b/app/helpers/admin/dashboard_helper.rb new file mode 100644 index 000000000..4ee2cdef4 --- /dev/null +++ b/app/helpers/admin/dashboard_helper.rb @@ -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 -- cgit From 08ec7435ce10fc74c257e089d6a2e909287e3daa Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 28 Mar 2019 02:16:01 +0100 Subject: Add order options to relationship manager UI (#10404) --- app/controllers/relationships_controller.rb | 9 +++++---- app/helpers/admin/filter_helper.rb | 2 +- app/views/relationships/show.html.haml | 7 +++++++ config/locales/en.yml | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'app/helpers/admin') diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index 84cb178a6..e6705c327 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -31,13 +31,14 @@ class RelationshipsController < ApplicationController def relationships_scope scope = begin if following_relationship? - current_account.following.joins(:account_stat) + current_account.following.eager_load(:account_stat).reorder(nil) else - current_account.followers.joins(:account_stat) + current_account.followers.eager_load(:account_stat).reorder(nil) end end - scope.merge!(Follow.recent) + scope.merge!(Follow.recent) if params[:order].blank? || params[:order] == 'recent' + scope.merge!(Account.by_recent_status) if params[:order] == 'active' scope.merge!(mutual_relationship_scope) if mutual_relationship? scope.merge!(moved_account_scope) if params[:status] == 'moved' scope.merge!(primary_account_scope) if params[:status] == 'primary' @@ -84,7 +85,7 @@ class RelationshipsController < ApplicationController end def current_params - params.slice(:page, :status, :relationship, :by_domain, :activity).permit(:page, :status, :relationship, :by_domain, :activity) + params.slice(:page, :status, :relationship, :by_domain, :activity, :order).permit(:page, :status, :relationship, :by_domain, :activity, :order) end def action_from_button diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 4fd36ef42..0bda25974 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -7,7 +7,7 @@ module Admin::FilterHelper CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze TAGS_FILTERS = %i(hidden).freeze INSTANCES_FILTERS = %i(limited by_domain).freeze - FOLLOWERS_FILTERS = %i(relationship status by_domain activity).freeze + FOLLOWERS_FILTERS = %i(relationship status by_domain activity order).freeze FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS + TAGS_FILTERS + INSTANCES_FILTERS + FOLLOWERS_FILTERS diff --git a/app/views/relationships/show.html.haml b/app/views/relationships/show.html.haml index 63745119a..e6fff0ad6 100644 --- a/app/views/relationships/show.html.haml +++ b/app/views/relationships/show.html.haml @@ -25,11 +25,18 @@ %li= filter_link_to t('generic.all'), activity: nil %li= filter_link_to t('relationships.dormant'), activity: 'dormant' + .filter-subset + %strong= t 'generic.order_by' + %ul + %li= filter_link_to t('relationships.most_recent'), order: nil + %li= filter_link_to t('relationships.last_active'), order: 'active' + = form_for(@form, url: relationships_path, method: :patch) do |f| = hidden_field_tag :page, params[:page] || 1 = hidden_field_tag :relationship, params[:relationship] = hidden_field_tag :status, params[:status] = hidden_field_tag :activity, params[:activity] + = hidden_field_tag :order, params[:order] .batch-table .batch-table__toolbar diff --git a/config/locales/en.yml b/config/locales/en.yml index 42ba4e35e..d91e89d95 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -774,6 +774,8 @@ en: relationships: activity: Account activity dormant: Dormant + last_active: Last active + most_recent: Most recent moved: Moved mutual: Mutual primary: Primary -- cgit