about summary refs log tree commit diff
path: root/app/views/admin
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-09-09 12:50:09 +0200
committerGitHub <noreply@github.com>2019-09-09 12:50:09 +0200
commit261e52268c05d2da4459a23e2898555dd5db5771 (patch)
tree51ff3e61b3de236a88953e660b3d57d39e78e976 /app/views/admin
parent3feacd2b14aeb60999c9ee83422c6c8090ed3ac2 (diff)
Add batch approve/reject for pending hashtags in admin UI (#11791)
Diffstat (limited to 'app/views/admin')
-rw-r--r--app/views/admin/tags/_tag.html.haml30
-rw-r--r--app/views/admin/tags/index.html.haml37
2 files changed, 53 insertions, 14 deletions
diff --git a/app/views/admin/tags/_tag.html.haml b/app/views/admin/tags/_tag.html.haml
index 91af8e492..670f3bc05 100644
--- a/app/views/admin/tags/_tag.html.haml
+++ b/app/views/admin/tags/_tag.html.haml
@@ -1,16 +1,20 @@
-.directory__tag
-  = link_to admin_tag_path(tag.id) do
-    %h4
-      = fa_icon 'hashtag'
-      = tag.name
+.batch-table__row
+  %label.batch-table__row__select.batch-table__row__select--aligned.batch-checkbox
+    = f.check_box :tag_ids, { multiple: true, include_hidden: false }, tag.id
 
-      %small
-        = t('admin.tags.in_directory', count: tag.accounts_count)
-        &bull;
-        = t('admin.tags.unique_uses_today', count: tag.history.first[:accounts])
+  .directory__tag
+    = link_to admin_tag_path(tag.id) do
+      %h4
+        = fa_icon 'hashtag'
+        = tag.name
 
-        - if tag.trending?
-          = fa_icon 'fire fw'
-          = t('admin.tags.trending_right_now')
+        %small
+          = t('admin.tags.in_directory', count: tag.accounts_count)
+          &bull;
+          = t('admin.tags.unique_uses_today', count: tag.history.first[:accounts])
 
-    .trends__item__current= number_to_human tag.history.first[:uses], strip_insignificant_zeros: true
+          - if tag.trending?
+            = fa_icon 'fire fw'
+            = t('admin.tags.trending_right_now')
+
+      .trends__item__current= number_to_human tag.history.first[:uses], strip_insignificant_zeros: true
diff --git a/app/views/admin/tags/index.html.haml b/app/views/admin/tags/index.html.haml
index d994955ef..324d13d3e 100644
--- a/app/views/admin/tags/index.html.haml
+++ b/app/views/admin/tags/index.html.haml
@@ -1,6 +1,9 @@
 - content_for :page_title do
   = t('admin.tags.title')
 
+- content_for :header_tags do
+  = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
+
 .filters
   .filter-subset
     %strong= t('admin.tags.context')
@@ -18,5 +21,37 @@
 
 %hr.spacer/
 
-= render @tags
+= form_for(@form, url: batch_admin_tags_path) do |f|
+  = hidden_field_tag :page, params[:page] || 1
+  = hidden_field_tag :context, params[:context]
+  = hidden_field_tag :review, params[:review]
+
+  .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
+        - if params[:review] == 'pending_review'
+          = f.button safe_join([fa_icon('check'), t('admin.accounts.approve')]), name: :approve, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
+
+          = f.button safe_join([fa_icon('times'), t('admin.accounts.reject')]), name: :reject, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
+        - else
+          %span.neutral-hint= t('generic.no_batch_actions_available')
+
+    .batch-table__body
+      - if @tags.empty?
+        = nothing_here 'nothing-here--under-tabs'
+      - else
+        = render partial: 'tag', collection: @tags, locals: { f: f }
+
 = paginate @tags
+
+- if params[:review] == 'pending_review'
+  %hr.spacer/
+
+  %div{ style: 'overflow: hidden' }
+    %div{ style: 'float: right' }
+      = link_to t('admin.accounts.reject_all'), reject_all_admin_tags_path, method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive'
+
+    %div
+      = link_to t('admin.accounts.approve_all'), approve_all_admin_tags_path, method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button'