about summary refs log tree commit diff
path: root/app/views/admin
diff options
context:
space:
mode:
authormayaeh <mayaeh@marimo-net.org>2019-09-16 21:27:29 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-09-16 14:27:29 +0200
commitef0d22f232723be035e95bde13310d02bf1c127b (patch)
tree114a12ef4c032dda781ba112b44a0c8ab6de8afc /app/views/admin
parentb7420b8643b4028796d1bbd9443241f997957eb4 (diff)
Add search and sort functions to hashtag admin UI (#11829)
* Add search and sort functions to hashtag admin UI

* Move scope processing from tags_controller to tag_filter

* Fix based on method naming conventions

* Fixed not to get 500 errors for invalid requests
Diffstat (limited to 'app/views/admin')
-rw-r--r--app/views/admin/tags/index.html.haml32
1 files changed, 26 insertions, 6 deletions
diff --git a/app/views/admin/tags/index.html.haml b/app/views/admin/tags/index.html.haml
index 324d13d3e..cea1b71b5 100644
--- a/app/views/admin/tags/index.html.haml
+++ b/app/views/admin/tags/index.html.haml
@@ -8,16 +8,36 @@
   .filter-subset
     %strong= t('admin.tags.context')
     %ul
-      %li= filter_link_to t('generic.all'), context: nil
-      %li= filter_link_to t('admin.tags.directory'), context: 'directory'
+      %li= filter_link_to t('generic.all'), directory: nil
+      %li= filter_link_to t('admin.tags.directory'), directory: '1'
 
   .filter-subset
     %strong= t('admin.tags.review')
     %ul
-      %li= filter_link_to t('generic.all'), review: nil
-      %li= filter_link_to t('admin.tags.unreviewed'), review: 'unreviewed'
-      %li= filter_link_to t('admin.tags.reviewed'), review: 'reviewed'
-      %li= filter_link_to safe_join([t('admin.accounts.moderation.pending'), "(#{Tag.pending_review.count})"], ' '), review: 'pending_review'
+      %li= filter_link_to t('generic.all'), reviewed: nil, unreviewed: nil, pending_review: nil
+      %li= filter_link_to t('admin.tags.unreviewed'), unreviewed: '1', reviewed: nil, pending_review: nil
+      %li= filter_link_to t('admin.tags.reviewed'), reviewed: '1', unreviewed: nil, pending_review: nil
+      %li= filter_link_to safe_join([t('admin.accounts.moderation.pending'), "(#{Tag.pending_review.count})"], ' '), pending_review: '1', reviewed: nil, unreviewed: nil
+
+  .filter-subset
+    %strong= t('generic.order_by')
+    %ul
+      %li= filter_link_to t('admin.tags.most_recent'), popular: nil, active: nil
+      %li= filter_link_to t('admin.tags.most_popular'), popular: '1', active: nil
+      %li= filter_link_to t('admin.tags.last_active'), active: '1', popular: nil
+
+= form_tag admin_tags_url, method: 'GET', class: 'simple_form' do
+  .fields-group
+    - Admin::FilterHelper::TAGS_FILTERS.each do |key|
+      = hidden_field_tag key, params[key] if params[key].present?
+
+    - %i(name).each do |key|
+      .input.string.optional
+        = text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.tags.#{key}")
+
+    .actions
+      %button= t('admin.accounts.search')
+      = link_to t('admin.accounts.reset'), admin_tags_path, class: 'button negative'
 
 %hr.spacer/