Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
fix ActiveAdmin filters to prevent silly queries
Browse files Browse the repository at this point in the history
  • Loading branch information
NealJMD authored and osahyoun committed Oct 18, 2016
1 parent acaeaed commit 1afdd35
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/admin/action.rb
Expand Up @@ -4,6 +4,12 @@

index pagination_total: false
config.per_page = 20
scope :active, show_count: false

filter :page_title_cont, label: 'Page'
filter :subscribed_member
filter :donation
filter :created_at

sidebar 'Previous Versions', only: :show do
attributes_table_for action do
Expand Down
5 changes: 5 additions & 0 deletions app/admin/donation_band.rb
Expand Up @@ -2,6 +2,11 @@
ActiveAdmin.register DonationBand do
actions :all, except: [:new, :edit]

index pagination_total: false
config.per_page = 20
scope :active, show_count: false
config.filters = false

sidebar 'Previous Versions', only: :show do
attributes_table_for donation_band do
row :versions do
Expand Down
6 changes: 6 additions & 0 deletions app/admin/image.rb
Expand Up @@ -4,6 +4,12 @@

index pagination_total: false
config.per_page = 20
scope :active, show_count: false

filter :page_title_cont, label: 'Page'
filter :content_file_name
filter :content_content_type
filter :content_file_size

sidebar 'Previous Versions', only: :show do
attributes_table_for image do
Expand Down
1 change: 1 addition & 0 deletions app/admin/language.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
ActiveAdmin.register Language do
permit_params :code, :name
config.filters = false

sidebar 'Previous Versions', only: :show do
attributes_table_for language do
Expand Down
9 changes: 9 additions & 0 deletions app/admin/link.rb
Expand Up @@ -2,6 +2,15 @@
ActiveAdmin.register Link do
permit_params :url, :title, :date, :source, :link_id

index pagination_total: false
config.per_page = 20
scope :active, show_count: false

filter :page_title_cont, label: 'Page'
filter :url
filter :title
filter :source

sidebar 'Previous Versions', only: :show do
attributes_table_for link do
row :versions do
Expand Down
10 changes: 10 additions & 0 deletions app/admin/liquid_layout.rb
Expand Up @@ -2,6 +2,16 @@
ActiveAdmin.register LiquidLayout do
actions :all, except: [:new, :edit]

index pagination_total: false
config.per_page = 20
scope :active, show_count: false

filter :title
filter :content
filter :experimental
filter :primary_layout
filter :post_action_layout

index do
selectable_column
id_column
Expand Down
5 changes: 5 additions & 0 deletions app/admin/liquid_partial.rb
Expand Up @@ -2,6 +2,11 @@
ActiveAdmin.register LiquidPartial do
actions :all, except: [:new, :edit, :destroy]

filter :title
filter :content
filter :created_at
filter :updated_at

index do
selectable_column
id_column
Expand Down
11 changes: 11 additions & 0 deletions app/admin/member.rb
Expand Up @@ -13,6 +13,17 @@

index pagination_total: false
config.per_page = 20
scope :active, show_count: false

filter :email
filter :country
filter :first_name
filter :last_name
filter :city
filter :postal
filter :donor_status
filter :created_at
filter :updated_at

actions :all, except: [:destroy]

Expand Down
10 changes: 10 additions & 0 deletions app/admin/page.rb
Expand Up @@ -4,6 +4,16 @@
permit_params :active, :featured

config.per_page = 20
scope :active, show_count: false

filter :liquid_layout, label: 'Layout'
filter :language
filter :follow_up_page_title_cont, label: 'Follow up page title'
filter :follow_up_liquid_layout, label: 'Follow up layout'
filter :title
filter :slug
filter :publish_status
filter :featured

index pagination_total: false do
selectable_column
Expand Down
3 changes: 3 additions & 0 deletions app/admin/pages_tag.rb
Expand Up @@ -4,6 +4,9 @@

config.per_page = 20
index pagination_total: false
scope :active, show_count: false

filter :page_title_cont

index do
selectable_column
Expand Down

0 comments on commit 1afdd35

Please sign in to comment.