Add admin area view partials for each record type (#2700)

This commit is contained in:
Matt Jankowski 2017-05-02 14:56:28 -04:00 committed by Eugen Rochko
parent 2128682162
commit b5eec34230
11 changed files with 82 additions and 75 deletions

View File

@ -3,7 +3,7 @@
module Admin module Admin
class DomainBlocksController < BaseController class DomainBlocksController < BaseController
def index def index
@blocks = DomainBlock.page(params[:page]) @domain_blocks = DomainBlock.page(params[:page])
end end
def new def new

View File

@ -0,0 +1,23 @@
%tr
%td.username
= account.username
%td.domain
- unless account.local?
= link_to account.domain, admin_accounts_path(by_domain: account.domain)
%td.confirmed
- if account.local?
- if account.user_confirmed?
%i.fa.fa-check
- else
%i.fa.fa-times
%td.subscribed
- if account.local?
= t('admin.accounts.location.local')
- elsif account.subscribed?
%i.fa.fa-check
- else
%i.fa.fa-times
%td
= table_link_to 'circle', t('admin.accounts.web'), web_path("accounts/#{account.id}")
= table_link_to 'globe', t('admin.accounts.public'), TagManager.instance.url_for(account)
= table_link_to 'pencil', t('admin.accounts.edit'), admin_account_path(account.id)

View File

@ -29,28 +29,6 @@
%th= fa_icon 'paper-plane-o' %th= fa_icon 'paper-plane-o'
%th %th
%tbody %tbody
- @accounts.each do |account| = render @accounts
%tr
%td= account.username
%td
- unless account.local?
= link_to account.domain, admin_accounts_path(by_domain: account.domain)
%td
- if account.local?
- if account.user.present? && account.user.confirmed?
%i.fa.fa-check
- else
%i.fa.fa-times
%td
- if account.local?
= t('admin.accounts.location.local')
- elsif account.subscribed?
%i.fa.fa-check
- else
%i.fa.fa-times
%td
= table_link_to 'circle', t('admin.accounts.web'), web_path("accounts/#{account.id}")
= table_link_to 'globe', t('admin.accounts.public'), TagManager.instance.url_for(account)
= table_link_to 'pencil', t('admin.accounts.edit'), admin_account_path(account.id)
= paginate @accounts = paginate @accounts

View File

@ -0,0 +1,10 @@
%tr
%td.domain
%samp= domain_block.domain
%td.severity
= t("admin.domain_blocks.severities.#{domain_block.severity}")
%td.reject_media
- if domain_block.reject_media? || domain_block.suspend?
%i.fa.fa-check
%td
= table_link_to 'undo', t('admin.domain_blocks.undo'), admin_domain_block_path(domain_block)

View File

@ -9,16 +9,7 @@
%th= t('admin.domain_blocks.reject_media') %th= t('admin.domain_blocks.reject_media')
%th %th
%tbody %tbody
- @blocks.each do |block| = render @domain_blocks
%tr
%td
%samp= block.domain
%td= t("admin.domain_blocks.severities.#{block.severity}")
%td
- if block.reject_media? || block.suspend?
%i.fa.fa-check
%td
= table_link_to 'undo', t('admin.domain_blocks.undo'), admin_domain_block_path(block)
= paginate @blocks = paginate @domain_blocks
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button' = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'

View File

@ -0,0 +1,5 @@
%tr
%td.domain
= instance.domain
%td.count
= instance.accounts_count

View File

@ -7,9 +7,6 @@
%th= t('admin.instances.domain_name') %th= t('admin.instances.domain_name')
%th= t('admin.instances.account_count') %th= t('admin.instances.account_count')
%tbody %tbody
- @instances.each do |instance| = render partial: 'instance', collection: @instances
%tr
%td= instance.domain
%td= instance.accounts_count
= paginate @instances = paginate @instances

View File

@ -0,0 +1,16 @@
%tr
%td
%samp= subscription.account.acct
%td
%samp= subscription.callback_url
%td
- if subscription.confirmed?
%i.fa.fa-check
%td{ style: "color: #{subscription.expired? ? 'red' : 'inherit'};" }
= precede subscription.expired? ? '-' : '' do
= time_ago_in_words(subscription.expires_at)
%td
- if subscription.last_successful_delivery_at?
= l subscription.last_successful_delivery_at
- else
%i.fa.fa-times

View File

@ -10,22 +10,6 @@
%th= t('admin.pubsubhubbub.expires_in') %th= t('admin.pubsubhubbub.expires_in')
%th= t('admin.pubsubhubbub.last_delivery') %th= t('admin.pubsubhubbub.last_delivery')
%tbody %tbody
- @subscriptions.each do |subscription| = render partial: 'subscription', collection: @subscriptions
%tr
%td
%samp= subscription.account.acct
%td
%samp= subscription.callback_url
%td
- if subscription.confirmed?
%i.fa.fa-check
%td{ style: "color: #{subscription.expired? ? 'red' : 'inherit'};" }
= precede subscription.expired? ? '-' : '' do
= time_ago_in_words(subscription.expires_at)
%td
- if subscription.last_successful_delivery_at?
= l subscription.last_successful_delivery_at
- else
%i.fa.fa-times
= paginate @subscriptions = paginate @subscriptions

View File

@ -0,0 +1,21 @@
%tr
%td.id
= "##{report.id}"
%td.target
= link_to report.target_account.acct, admin_account_path(report.target_account.id)
%td.reporter
= link_to report.account.acct, admin_account_path(report.account.id)
%td.comment
%span{title: report.comment}
= truncate(report.comment, length: 30, separator: ' ')
%td.stats
- unless report.statuses.empty?
%span{title: t('admin.accounts.statuses')}
= fa_icon('comment')
= report.statuses.count
- unless report.media_attachments.empty?
%span{title: t('admin.accounts.media_attachments')}
= fa_icon('camera')
= report.media_attachments.count
%td
= table_link_to 'circle', t('admin.reports.view'), admin_report_path(report)

View File

@ -21,24 +21,6 @@
%th= t('admin.reports.report_contents') %th= t('admin.reports.report_contents')
%th %th
%tbody %tbody
- @reports.each do |report| = render @reports
%tr
-# %td= check_box_tag 'select', report.id
%td= "##{report.id}"
%td= link_to report.target_account.acct, admin_account_path(report.target_account.id)
%td= link_to report.account.acct, admin_account_path(report.account.id)
%td
%span{title: report.comment}
= truncate(report.comment, length: 30, separator: ' ')
%td
- unless report.statuses.empty?
%span{title: t('admin.accounts.statuses')}
= fa_icon('comment')
= report.statuses.count
- unless report.media_attachments.empty?
%span{title: t('admin.accounts.media_attachments')}
= fa_icon('camera')
= report.media_attachments.count
%td= table_link_to 'circle', t('admin.reports.view'), admin_report_path(report)
= paginate @reports = paginate @reports