Added/Updated admin dashboard tables

• Added:
- New Account filtering
- PreviewCard viewing/sorting/filtering deleting (todo)
- DeletePreviewCardWorker, Service
- Status viewing/sorting/filtering deleting
- ChatMessage viewing/sorting/filtering deleting (todo)
- Account > Follows view

• Updated:
- LinkBlock to sort alphabetically
- Groups to be under "Moderation" instead of "Admin" in navigation.rb
- Status in admin to have group name/link
- Reports reset button
- Group filtering/sorting
- LinkBlock filtering/sorting
- Account now has bio and few more data points in dashboard
This commit is contained in:
mgabdev
2021-01-19 01:25:25 -05:00
parent 24fa2d3a74
commit 51fa8f2eb4
39 changed files with 697 additions and 108 deletions

View File

@@ -0,0 +1,37 @@
- content_for :header_tags do
= javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
- content_for :page_title do
= t('admin.statuses.title')
\-
= "@#{@account.acct}"
.filters
.filter-subset
%strong= t('admin.statuses.media.title')
%ul
%li= link_to t('admin.statuses.no_media'), admin_account_account_statuses_path(@account.id, current_params.merge(media: nil)), class: !params[:media] && 'selected'
%li= link_to t('admin.statuses.with_media'), admin_account_account_statuses_path(@account.id, current_params.merge(media: true)), class: params[:media] && 'selected'
.back-link{ style: 'flex: 1 1 auto; text-align: right' }
= link_to admin_account_path(@account.id) do
= fa_icon 'chevron-left fw'
= t('admin.statuses.back_to_account')
%hr.spacer/
= form_for(@form, url: admin_account_account_statuses_path(@account.id)) do |f|
= hidden_field_tag :page, params[:page]
= hidden_field_tag :media, params[:media]
.batch-table
.batch-table__toolbar
%label.batch-table__toolbar__select.batch-checkbox-all
= check_box_tag :batch_checkbox_all, nil, false
.batch-table__toolbar__actions
= f.button safe_join([fa_icon('eye-slash'), t('admin.statuses.batch.nsfw_on')]), name: :nsfw_on, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
= f.button safe_join([fa_icon('eye'), t('admin.statuses.batch.nsfw_off')]), name: :nsfw_off, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
= f.button safe_join([fa_icon('trash'), t('admin.statuses.batch.delete')]), name: :delete, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
.batch-table__body
= render partial: 'admin/reports/status', collection: @statuses, locals: { f: f }
= paginate @statuses

View File

@@ -20,11 +20,17 @@
- if params[key].present?
= hidden_field_tag key, params[key]
- %i(username by_domain display_name email ip).each do |key|
- %i(username by_domain display_name email ip note).each do |key|
- unless key == :by_domain && params[:remote].blank?
.input.string.optional
= text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.accounts.#{key}")
.input.string.optional
= text_field_tag :status_count_gte, params[:status_count_gte], class: 'string optional', placeholder: "Status Count >="
.input.string.optional
= text_field_tag :sign_up_date_gte, params[:sign_up_date_gte], class: 'string optional', placeholder: "Sign up Date >= (MM-DD-YYYY)"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_accounts_path, class: 'button negative'

View File

@@ -5,25 +5,13 @@
.dashboard__counters{ style: 'margin-top: 10px' }
%div
= link_to admin_account_statuses_path(@account.id) do
= link_to admin_account_account_statuses_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.statuses_count
.dashboard__counters__label= t 'admin.accounts.statuses'
%div
= link_to admin_account_statuses_path(@account.id, { media: true }) do
= link_to admin_account_account_statuses_path(@account.id, { media: true }) do
.dashboard__counters__num= number_to_human_size @account.media_attachments.sum('file_file_size')
.dashboard__counters__label= t 'admin.accounts.media_attachments'
%div
= link_to admin_account_followers_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.local_followers_count
.dashboard__counters__label= t 'admin.accounts.followers'
%div
= link_to admin_reports_path(account_id: @account.id) do
.dashboard__counters__num= number_with_delimiter @account.reports.count
.dashboard__counters__label= t '.created_reports'
%div
= link_to admin_reports_path(target_account_id: @account.id) do
.dashboard__counters__num= number_with_delimiter @account.targeted_reports.count
.dashboard__counters__label= t '.targeted_reports'
%div
%div
.dashboard__counters__text
@@ -42,12 +30,36 @@
- else
%span.neutral= t('admin.accounts.no_limits_imposed')
.dashboard__counters__label= t 'admin.accounts.login_status'
%div
= link_to admin_account_followers_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.local_followers_count
.dashboard__counters__label= t 'admin.accounts.followers'
%div
= link_to admin_account_follows_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.local_following_count
.dashboard__counters__label= t 'admin.accounts.following'
%div
%a
.dashboard__counters__num= number_with_delimiter @account.blocked_by.count
.dashboard__counters__label Blocked By
%div
= link_to admin_reports_path(account_id: @account.id) do
.dashboard__counters__num= number_with_delimiter @account.reports.count
.dashboard__counters__label= t '.created_reports'
%div
= link_to admin_reports_path(target_account_id: @account.id) do
.dashboard__counters__num= number_with_delimiter @account.targeted_reports.count
.dashboard__counters__label= t '.targeted_reports'
%div
= link_to admin_account_joined_groups_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.groups.count
.dashboard__counters__label Joined Groups
%div
= link_to admin_account_chat_conversation_accounts_path(@account.id) do
= link_to admin_account_joined_groups_path(@account.id) do
.dashboard__counters__num= number_with_delimiter @account.group_removed_accounts.count
.dashboard__counters__label Removed by Groups
%div
%a{href: "/admin/chat_messages?account_id=#{@account.id}"}
.dashboard__counters__num= number_with_delimiter @account.chat_conversation_accounts_count
.dashboard__counters__label Chat Conversations
%div

View File

@@ -2,19 +2,26 @@
= javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
- content_for :page_title do
%span Chat Messages
\-
= "@#{@account.acct}"
= "Chat Messages"
.filters
.back-link{ style: 'flex: 1 1 auto; text-align: right' }
= link_to admin_account_path(@account.id) do
= fa_icon 'chevron-left fw'
%span Back to account
= form_tag admin_chat_messages_url, method: 'GET', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :text, params[:text], class: 'string optional', placeholder: "Text contains"
.input.string.optional
= text_field_tag :id, params[:id], class: 'string optional', placeholder: "Id"
.input.string.optional
= text_field_tag :account_id, params[:account_id], class: 'string optional', placeholder: "Account Id"
.input.string.optional
= text_field_tag :created_at_gte, params[:created_at_gte], class: 'string optional', placeholder: "Created >= (MM-DD-YYYY)"
.input.string.optional
= text_field_tag :created_at_lte, params[:created_at_lte], class: 'string optional', placeholder: "Created <= (MM-DD-YYYY)"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_chat_messages_path, class: 'button negative'
%hr.spacer/
= form_for(@form, url: admin_account_chat_messages_path(@account.id)) do |f|
= form_for(@form, url: admin_chat_messages_path('')) do |f|
= hidden_field_tag :page, params[:page]
.batch-table

View File

@@ -0,0 +1,28 @@
- content_for :page_title do
= "#{@account.acct} is Following..."
.filters
.filter-subset
%strong= t('admin.accounts.location.title')
%ul
%li= link_to t('admin.accounts.location.local'), admin_account_follows_path(@account.id), class: 'selected'
.back-link{ style: 'flex: 1 1 auto; text-align: right' }
= link_to admin_account_path(@account.id) do
= fa_icon 'chevron-left fw'
= t('admin.followers.back_to_account')
%hr.spacer/
.table-wrapper
%table.table
%thead
%tr
%th= t('admin.accounts.username')
%th= t('admin.accounts.role')
%th= t('admin.accounts.most_recent_ip')
%th= t('admin.accounts.most_recent_activity')
%th
%tbody
= render partial: 'admin/accounts/account', collection: @follows
= paginate @follows

View File

@@ -4,8 +4,15 @@
= form_tag admin_groups_url, method: 'GET', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :title, params[:title], class: 'string optional', placeholder: I18n.t("admin.groups.name")
= text_field_tag :id, params[:id], class: 'string optional', placeholder: "Id"
.input.string.optional
= text_field_tag :title, params[:title], class: 'string optional', placeholder: "Title"
.input.string.optional
= text_field_tag :description, params[:description], class: 'string optional', placeholder: "Description"
.input.string.optional
= text_field_tag :member_count_gte, params[:member_count_gte], class: 'string optional', placeholder: "Member Count >="
.input.string.optional
= text_field_tag :created_at_gte, params[:created_at_gte], class: 'string optional', placeholder: "Created >= (MM-DD-YYYY)"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_groups_path, class: 'button negative'

View File

@@ -15,7 +15,7 @@
.dashboard__counters{ style: 'margin-top: 10px' }
%div
%div
%a{href: "/admin/statuses?group_id=#{@group.id}"}
.dashboard__counters__num= number_with_delimiter Status.where(group:@group).count
.dashboard__counters__label Status Count
%div
@@ -30,6 +30,11 @@
%div
.dashboard__counters__num= number_with_delimiter @group.join_requests.count
.dashboard__counters__label Member Requests Count
%div
%div
.dashboard__counters__num
%time.formatted{ datetime: @group.created_at.iso8601, title: l(@group.created_at) }= l(@group.created_at)
.dashboard__counters__label Created
= simple_form_for(@group, url: admin_group_path(@group.id), html: { method: :put }) do |f|
= render 'shared/error_messages', object: @group

View File

@@ -1,6 +1,15 @@
- content_for :page_title do
= t('admin.link_blocks.title')
= form_tag admin_link_blocks_url, method: 'GET', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :link, params[:link], class: 'string optional', placeholder: "Link"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_link_blocks_path, class: 'button negative'
.table-wrapper
%table.table
%thead

View File

@@ -0,0 +1,14 @@
.batch-table__row
%label.batch-table__row__select.batch-checkbox
= f.check_box :preview_card_ids, { multiple: true, include_hidden: false }, preview_card.id
.batch-table__row__content
%div
%div{style: "display:flex;flex-direction:row;"}
- if !preview_card.image.nil?
%div{style: "display:block;padding-right:10px;"}
%img{src: preview_card.image, style: "display:block;width:80px;height:60px;"}
%div
%p{style: "color:#fff;font-size:14px;font-weight:600;margin-bottom:5px;"}= preview_card.title
%p{style: "color:#bbb;font-size:12px;font-weight:400;margin-bottom:5px;"}= preview_card.description
%p{style: "color:#21D07B;font-size:12px;font-weight:400;"}= preview_card.url
%a{href: "/admin/statuses?preview_card_id=#{preview_card.id}", style: "display:block;padding:6px;background-color:#666;color:#000;margin-top:6px;font-size:13px;width:90px;line-height:20px;text-decoration:none;text-align:center;border-radius:8px;"} View Statuses

View File

@@ -0,0 +1,32 @@
- content_for :page_title do
= "Preview Cards"
= form_tag admin_preview_cards_url, method: 'GET', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :title, params[:title], class: 'string optional', placeholder: "Title"
.input.string.optional
= text_field_tag :description, params[:description], class: 'string optional', placeholder: "Description"
.input.string.optional
= text_field_tag :url, params[:url], class: 'string optional', placeholder: "Url"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_preview_cards_path, class: 'button negative'
= form_for(@form, url: admin_preview_cards_path()) do |f|
= hidden_field_tag :page, params[:page]
= hidden_field_tag :media, params[:media]
.batch-table
.batch-table__toolbar
%label.batch-table__toolbar__select.batch-checkbox-all
= check_box_tag :batch_checkbox_all, nil, false
.batch-table__toolbar__actions
= f.button safe_join([fa_icon('trash'), "Delete"]), name: :delete, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
.batch-table__body
= render partial: 'admin/preview_cards/preview_card', collection: @preview_cards, locals: { f: f }
= paginate @preview_cards

View File

@@ -32,3 +32,6 @@
·
= fa_icon('eye-slash fw')
= t('stream_entries.sensitive_content')
- if !status.group_id.nil?
·
%a{href: "/groups/#{status.group_id}", style: "color:#757575;text-decoration:none;font-size:14px;"}= status.group.title

View File

@@ -10,13 +10,12 @@
= form_tag admin_reports_url, method: 'GET', class: 'simple_form' do
.fields-group
- %i(comment).each do |key|
.input.string.optional
= text_field_tag key, params[key], class: 'string optional', placeholder: "#{key}"
.input.string.optional
= text_field_tag :comment, params[:comment], class: 'string optional', placeholder: "Comment"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_accounts_path, class: 'button negative'
= link_to t('admin.accounts.reset'), admin_reports_path, class: 'button negative'
- @reports.group_by(&:target_account_id).each do |target_account_id, reports|
- target_account = reports.first.target_account

View File

@@ -2,24 +2,30 @@
= javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
- content_for :page_title do
= t('admin.statuses.title')
\-
= "@#{@account.acct}"
= "All Statuses"
.filters
.filter-subset
%strong= t('admin.statuses.media.title')
%ul
%li= link_to t('admin.statuses.no_media'), admin_account_statuses_path(@account.id, current_params.merge(media: nil)), class: !params[:media] && 'selected'
%li= link_to t('admin.statuses.with_media'), admin_account_statuses_path(@account.id, current_params.merge(media: true)), class: params[:media] && 'selected'
.back-link{ style: 'flex: 1 1 auto; text-align: right' }
= link_to admin_account_path(@account.id) do
= fa_icon 'chevron-left fw'
= t('admin.statuses.back_to_account')
= form_tag admin_statuses_url, method: 'GET', class: 'simple_form' do
.fields-group
.input.string.optional
= text_field_tag :text, params[:text], class: 'string optional', placeholder: "Text contains"
.input.string.optional
= text_field_tag :id, params[:id], class: 'string optional', placeholder: "Id"
.input.string.optional
= text_field_tag :account_id, params[:account_id], class: 'string optional', placeholder: "Account Id"
.input.string.optional
= text_field_tag :group_id, params[:group_id], class: 'string optional', placeholder: "Group Id"
.input.string.optional
= text_field_tag :preview_card_id, params[:preview_card_id], class: 'string optional', placeholder: "Preview Card Id"
.input.string.optional
= text_field_tag :created_at_gte, params[:created_at_gte], class: 'string optional', placeholder: "Created >= (MM-DD-YYYY)"
.input.string.optional
= text_field_tag :created_at_lte, params[:created_at_lte], class: 'string optional', placeholder: "Created <= (MM-DD-YYYY)"
.actions
%button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_statuses_path, class: 'button negative'
%hr.spacer/
= form_for(@form, url: admin_account_statuses_path(@account.id)) do |f|
= form_for(@form, url: admin_statuses_path) do |f|
= hidden_field_tag :page, params[:page]
= hidden_field_tag :media, params[:media]