about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-20 15:55:03 +0100
committerGitHub <noreply@github.com>2020-01-20 15:55:03 +0100
commit6feafb8802b2759eb33968a70b6c1cb100bf3926 (patch)
tree5df6ee7f77b92dec9ab6e848ec663b9f4b5838c4 /app/views
parent06f6995860d507ac26f23722506420b5cdae2ffe (diff)
Various fixes and improvements (#12878)
* Fix unused role routes being generated

* Remove unused JavaScript code

* Refactor filters code to be DRYer

* Fix `.count == 0` comparisons to `.empty?` in views

* Fix filters in views
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin/accounts/index.html.haml2
-rw-r--r--app/views/admin/custom_emojis/index.html.haml4
-rw-r--r--app/views/admin/email_domain_blocks/index.html.haml2
-rw-r--r--app/views/admin/instances/index.html.haml5
-rw-r--r--app/views/admin/reports/index.html.haml5
-rw-r--r--app/views/admin/tags/index.html.haml5
-rw-r--r--app/views/filters/index.html.haml2
-rw-r--r--app/views/relationships/show.html.haml7
-rw-r--r--app/views/settings/applications/index.html.haml2
9 files changed, 15 insertions, 19 deletions
diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml
index 7e9adb3ff..3a85324c9 100644
--- a/app/views/admin/accounts/index.html.haml
+++ b/app/views/admin/accounts/index.html.haml
@@ -22,7 +22,7 @@
 
 = form_tag admin_accounts_url, method: 'GET', class: 'simple_form' do
   .fields-group
-    - Admin::FilterHelper::ACCOUNT_FILTERS.each do |key|
+    - AccountFilter::KEYS.each do |key|
       - if params[key].present?
         = hidden_field_tag key, params[key]
 
diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml
index 389e9dd71..69aa5ae41 100644
--- a/app/views/admin/custom_emojis/index.html.haml
+++ b/app/views/admin/custom_emojis/index.html.haml
@@ -25,7 +25,7 @@
 
 = form_tag admin_custom_emojis_url, method: 'GET', class: 'simple_form' do
   .fields-group
-    - Admin::FilterHelper::CUSTOM_EMOJI_FILTERS.each do |key|
+    - CustomEmojiFilter::KEYS.each do |key|
       = hidden_field_tag key, params[key] if params[key].present?
 
     - %i(shortcode by_domain).each do |key|
@@ -39,7 +39,7 @@
 = form_for(@form, url: batch_admin_custom_emojis_path) do |f|
   = hidden_field_tag :page, params[:page] || 1
 
-  - Admin::FilterHelper::CUSTOM_EMOJI_FILTERS.each do |key|
+  - CustomEmojiFilter::KEYS.each do |key|
     = hidden_field_tag key, params[key] if params[key].present?
 
   .batch-table
diff --git a/app/views/admin/email_domain_blocks/index.html.haml b/app/views/admin/email_domain_blocks/index.html.haml
index c1cc470b6..6015cfac0 100644
--- a/app/views/admin/email_domain_blocks/index.html.haml
+++ b/app/views/admin/email_domain_blocks/index.html.haml
@@ -4,7 +4,7 @@
 - content_for :heading_actions do
   = link_to t('admin.email_domain_blocks.add_new'), new_admin_email_domain_block_path, class: 'button'
 
-- if @email_domain_blocks.count == 0
+- if @email_domain_blocks.empty?
   %div.muted-hint.center-text=t 'admin.email_domain_blocks.empty'
 - else
   .table-wrapper
diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml
index 1d85aa75e..0b299acc5 100644
--- a/app/views/admin/instances/index.html.haml
+++ b/app/views/admin/instances/index.html.haml
@@ -19,9 +19,8 @@
 - unless whitelist_mode?
   = form_tag admin_instances_url, method: 'GET', class: 'simple_form' do
     .fields-group
-      - Admin::FilterHelper::INSTANCES_FILTERS.each do |key|
-        - if params[key].present?
-          = hidden_field_tag key, params[key]
+      - InstanceFilter::KEYS.each do |key|
+        = hidden_field_tag key, params[key] if params[key].present?
 
       - %i(by_domain).each do |key|
         .input.string.optional
diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml
index 30c7549b0..0263b80fb 100644
--- a/app/views/admin/reports/index.html.haml
+++ b/app/views/admin/reports/index.html.haml
@@ -10,9 +10,8 @@
 
 = form_tag admin_reports_url, method: 'GET', class: 'simple_form' do
   .fields-group
-    - Admin::FilterHelper::REPORT_FILTERS.each do |key|
-      - if params[key].present?
-        = hidden_field_tag key, params[key]
+    - ReportFilter::KEYS.each do |key|
+      = hidden_field_tag key, params[key] if params[key].present?
 
     - %i(by_target_domain).each do |key|
       .input.string.optional
diff --git a/app/views/admin/tags/index.html.haml b/app/views/admin/tags/index.html.haml
index 7f2c53190..1ff538ba3 100644
--- a/app/views/admin/tags/index.html.haml
+++ b/app/views/admin/tags/index.html.haml
@@ -28,7 +28,7 @@
 
 = form_tag admin_tags_url, method: 'GET', class: 'simple_form' do
   .fields-group
-    - Admin::FilterHelper::TAGS_FILTERS.each do |key|
+    - TagFilter::KEYS.each do |key|
       = hidden_field_tag key, params[key] if params[key].present?
 
     - %i(name).each do |key|
@@ -43,9 +43,8 @@
 
 = form_for(@form, url: batch_admin_tags_path) do |f|
   = hidden_field_tag :page, params[:page] || 1
-  = hidden_field_tag :name, params[:name] if params[:name].present?
 
-  - Admin::FilterHelper::TAGS_FILTERS.each do |key|
+  - TagFilter::KEYS.each do |key|
     = hidden_field_tag key, params[key] if params[key].present?
 
   .batch-table.optional
diff --git a/app/views/filters/index.html.haml b/app/views/filters/index.html.haml
index 8ace638ca..b4d5333aa 100644
--- a/app/views/filters/index.html.haml
+++ b/app/views/filters/index.html.haml
@@ -4,7 +4,7 @@
 - content_for :heading_actions do
   = link_to t('filters.new.title'), new_filter_path, class: 'button'
 
-- if @filters.count == 0
+- if @filters.empty?
   %div.muted-hint.center-text= t 'filters.index.empty'
 - else
   .table-wrapper
diff --git a/app/views/relationships/show.html.haml b/app/views/relationships/show.html.haml
index 0da1596ce..099bb3202 100644
--- a/app/views/relationships/show.html.haml
+++ b/app/views/relationships/show.html.haml
@@ -33,10 +33,9 @@
 
 = form_for(@form, url: relationships_path, method: :patch) do |f|
   = hidden_field_tag :page, params[:page] || 1
-  = hidden_field_tag :relationship, params[:relationship]
-  = hidden_field_tag :status, params[:status]
-  = hidden_field_tag :activity, params[:activity]
-  = hidden_field_tag :order, params[:order]
+
+  - RelationshipFilter::KEYS.each do |key|
+    = hidden_field_tag key, params[key] if params[key].present?
 
   .batch-table
     .batch-table__toolbar
diff --git a/app/views/settings/applications/index.html.haml b/app/views/settings/applications/index.html.haml
index 1cb94760f..a1f904a3a 100644
--- a/app/views/settings/applications/index.html.haml
+++ b/app/views/settings/applications/index.html.haml
@@ -4,7 +4,7 @@
 - content_for :heading_actions do
   = link_to t('doorkeeper.applications.index.new'), new_settings_application_path, class: 'button'
 
-- if @applications.count == 0
+- if @applications.empty?
   %div.muted-hint.center-text=t 'doorkeeper.applications.index.empty'
 - else
   .table-wrapper