From fa74c34095fbea69c23949d6e12d7cec068d74ac Mon Sep 17 00:00:00 2001 From: Developer <> Date: Thu, 18 Feb 2021 16:49:14 -0500 Subject: [PATCH] Added account_flags_block partial to admin pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - account_flags_block partial to admin pages (groups, accounts, reports) so admin/moderators can easily see pro, verified, investor, donor, spam flags of an account --- app/views/admin/accounts/_account.html.haml | 12 +----------- .../admin/accounts/_account_flags_block.html.haml | 11 +++++++++++ app/views/admin/groups/show.html.haml | 6 ++++-- app/views/admin/reports/show.html.haml | 4 ++-- app/views/application/_card.html.haml | 4 +++- 5 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 app/views/admin/accounts/_account_flags_block.html.haml diff --git a/app/views/admin/accounts/_account.html.haml b/app/views/admin/accounts/_account.html.haml index 63bcdbda..5def2caa 100644 --- a/app/views/admin/accounts/_account.html.haml +++ b/app/views/admin/accounts/_account.html.haml @@ -9,14 +9,4 @@ %td %samp= number_with_delimiter account.statuses.count %td - %div{ :style => "display:flex;flex-direction:row;" } - - if account.is_flagged_as_spam - %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#781600;border-radius:6px;color:#fff;width:40px;line-height:22px;font-weight:600;padding:2px 0 0 6px;" } SPAM - - if account.is_pro - %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#FFD700;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } P - - if account.is_verified - %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#fff;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } V - - if account.is_donor - %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#4EA6FF;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } D - - if account.is_investor - %span{ :style => "display:inline-block;font-size:12px;background-color:#6DD900;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } I \ No newline at end of file + = render 'admin/accounts/account_flags_block', :account => account \ No newline at end of file diff --git a/app/views/admin/accounts/_account_flags_block.html.haml b/app/views/admin/accounts/_account_flags_block.html.haml new file mode 100644 index 00000000..d097c2a8 --- /dev/null +++ b/app/views/admin/accounts/_account_flags_block.html.haml @@ -0,0 +1,11 @@ +%div{ :style => "display:flex;flex-direction:row;" } + - if account.is_flagged_as_spam + %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#781600;border-radius:6px;color:#fff;width:40px;line-height:22px;font-weight:600;padding:2px 0 0 6px;" } SPAM + - if account.is_pro + %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#FFD700;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } P + - if account.is_verified + %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#fff;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } V + - if account.is_donor + %span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#4EA6FF;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } D + - if account.is_investor + %span{ :style => "display:inline-block;font-size:12px;background-color:#6DD900;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } I \ No newline at end of file diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index b297ace8..51c24806 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -85,14 +85,16 @@ %th Role %tbody %tr - %td + %td{style: "display:flex;flex-direction:row;align-items:center;"} = admin_account_link_to(@group.account) + %div{style:"margin-left:10px;"}= render 'admin/accounts/account_flags_block', :account => @group.account %td %span Group Creator - @admins.each do |acct| %tr - %td + %td{style: "display:flex;flex-direction:row;align-items:center;"} = admin_account_link_to(acct.account) + %div{style:"margin-left:10px;"}= render 'admin/accounts/account_flags_block', :account => acct.account %td %span Admin - @mods.each do |acct| diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index a512f970..14c2016d 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -27,13 +27,13 @@ %th= t('admin.reports.reported_account') %td= admin_account_link_to @report.target_account %td= table_link_to 'flag', pluralize(@report.target_account.targeted_reports.count, t('admin.reports.account.report')), admin_reports_path(target_account_id: @report.target_account.id) - %td= table_link_to 'file', pluralize(@report.target_account.targeted_moderation_notes.count, t('admin.reports.account.note')), admin_reports_path(target_account_id: @report.target_account.id) + %td= render 'admin/accounts/account_flags_block', :account => @report.target_account %tr %th= t('admin.reports.reported_by') - if @report.account.local? %td= admin_account_link_to @report.account %td= table_link_to 'flag', pluralize(@report.account.targeted_reports.count, t('admin.reports.account.report')), admin_reports_path(target_account_id: @report.account.id) - %td= table_link_to 'file', pluralize(@report.account.targeted_moderation_notes.count, t('admin.reports.account.note')), admin_reports_path(target_account_id: @report.account.id) + %td= render 'admin/accounts/account_flags_block', :account => @report.account - else %td{ colspan: 3 }= @report.account.domain %tr diff --git a/app/views/application/_card.html.haml b/app/views/application/_card.html.haml index f18418e4..87b21af7 100644 --- a/app/views/application/_card.html.haml +++ b/app/views/application/_card.html.haml @@ -10,8 +10,10 @@ = image_tag account.avatar.url, alt: '', width: 48, height: 48, class: 'u-photo' .display-name %span{id: "default_account_display_name", style: "display:none;"}= account.username - %bdi + %span{style: "display:flex;flex-direction:row;align-items:center;"} %strong.emojify.p-name= display_name(account, custom_emojify: true) + %div{style: "margin-left:auto;"} + = render 'admin/accounts/account_flags_block', :account => @account %span = acct(account) = fa_icon('lock') if account.locked?