about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-02 14:56:28 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-02 20:56:28 +0200
commitb5eec3423044f66066d64bd5c9422f40113c543a (patch)
tree253ae02c771888fe7c84d32383bc838fb626a45c /app
parent212868216230120b63b162ab40cf271deadadd63 (diff)
Add admin area view partials for each record type (#2700)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/domain_blocks_controller.rb2
-rw-r--r--app/views/admin/accounts/_account.html.haml23
-rw-r--r--app/views/admin/accounts/index.html.haml24
-rw-r--r--app/views/admin/domain_blocks/_domain_block.html.haml10
-rw-r--r--app/views/admin/domain_blocks/index.html.haml13
-rw-r--r--app/views/admin/instances/_instance.html.haml5
-rw-r--r--app/views/admin/instances/index.html.haml5
-rw-r--r--app/views/admin/pubsubhubbub/_subscription.html.haml16
-rw-r--r--app/views/admin/pubsubhubbub/index.html.haml18
-rw-r--r--app/views/admin/reports/_report.html.haml21
-rw-r--r--app/views/admin/reports/index.html.haml20
11 files changed, 82 insertions, 75 deletions
diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb
index 72bf1cd0d..10396899b 100644
--- a/app/controllers/admin/domain_blocks_controller.rb
+++ b/app/controllers/admin/domain_blocks_controller.rb
@@ -3,7 +3,7 @@
 module Admin
   class DomainBlocksController < BaseController
     def index
-      @blocks = DomainBlock.page(params[:page])
+      @domain_blocks = DomainBlock.page(params[:page])
     end
 
     def new
diff --git a/app/views/admin/accounts/_account.html.haml b/app/views/admin/accounts/_account.html.haml
new file mode 100644
index 000000000..c513776b7
--- /dev/null
+++ b/app/views/admin/accounts/_account.html.haml
@@ -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)
diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml
index c52b3ff74..0cff944ba 100644
--- a/app/views/admin/accounts/index.html.haml
+++ b/app/views/admin/accounts/index.html.haml
@@ -29,28 +29,6 @@
       %th= fa_icon 'paper-plane-o'
       %th
   %tbody
-    - @accounts.each do |account|
-      %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)
+    = render @accounts
 
 = paginate @accounts
diff --git a/app/views/admin/domain_blocks/_domain_block.html.haml b/app/views/admin/domain_blocks/_domain_block.html.haml
new file mode 100644
index 000000000..17a3de81c
--- /dev/null
+++ b/app/views/admin/domain_blocks/_domain_block.html.haml
@@ -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)
diff --git a/app/views/admin/domain_blocks/index.html.haml b/app/views/admin/domain_blocks/index.html.haml
index bdef4294e..5ae9fec53 100644
--- a/app/views/admin/domain_blocks/index.html.haml
+++ b/app/views/admin/domain_blocks/index.html.haml
@@ -9,16 +9,7 @@
       %th= t('admin.domain_blocks.reject_media')
       %th
   %tbody
-    - @blocks.each do |block|
-      %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)
+    = render @domain_blocks
 
-= paginate @blocks
+= paginate @domain_blocks
 = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'
diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml
new file mode 100644
index 000000000..5c6783d06
--- /dev/null
+++ b/app/views/admin/instances/_instance.html.haml
@@ -0,0 +1,5 @@
+%tr
+  %td.domain
+    = instance.domain
+  %td.count
+    = instance.accounts_count
diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml
index b5ad40ac6..e5955e6bf 100644
--- a/app/views/admin/instances/index.html.haml
+++ b/app/views/admin/instances/index.html.haml
@@ -7,9 +7,6 @@
       %th= t('admin.instances.domain_name')
       %th= t('admin.instances.account_count')
   %tbody
-    - @instances.each do |instance|
-      %tr
-        %td= instance.domain
-        %td= instance.accounts_count
+    = render partial: 'instance', collection: @instances
 
 = paginate @instances
diff --git a/app/views/admin/pubsubhubbub/_subscription.html.haml b/app/views/admin/pubsubhubbub/_subscription.html.haml
new file mode 100644
index 000000000..024788e13
--- /dev/null
+++ b/app/views/admin/pubsubhubbub/_subscription.html.haml
@@ -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
diff --git a/app/views/admin/pubsubhubbub/index.html.haml b/app/views/admin/pubsubhubbub/index.html.haml
index 852e84f11..066d9e5c6 100644
--- a/app/views/admin/pubsubhubbub/index.html.haml
+++ b/app/views/admin/pubsubhubbub/index.html.haml
@@ -10,22 +10,6 @@
       %th= t('admin.pubsubhubbub.expires_in')
       %th= t('admin.pubsubhubbub.last_delivery')
   %tbody
-    - @subscriptions.each do |subscription|
-      %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
+    = render partial: 'subscription', collection: @subscriptions
 
 = paginate @subscriptions
diff --git a/app/views/admin/reports/_report.html.haml b/app/views/admin/reports/_report.html.haml
new file mode 100644
index 000000000..2be1f8f2a
--- /dev/null
+++ b/app/views/admin/reports/_report.html.haml
@@ -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)
diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml
index 7db9af6d1..f1c4a93c4 100644
--- a/app/views/admin/reports/index.html.haml
+++ b/app/views/admin/reports/index.html.haml
@@ -21,24 +21,6 @@
         %th= t('admin.reports.report_contents')
         %th
     %tbody
-      - @reports.each do |report|
-        %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)
+      = render @reports
 
 = paginate @reports