From bebc4694dde06233ddc170678da6daa6cf5cc1bd Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 12 Jan 2020 00:59:36 -0600 Subject: [PATCH] pools: remove is_active flag. Remove uses of the is_active flag. Keep column in database (for now). The only purpose of this flag was to filter out pools from the pool list in the Add to Pool dialog. This hasn't had much use since autocomplete was added. Most pools didn't set the flag correctly anyway. --- app/controllers/pool_elements_controller.rb | 2 +- app/controllers/pools_controller.rb | 2 +- app/models/pool.rb | 2 +- app/views/pool_versions/search.html.erb | 3 +-- app/views/pools/_search.html.erb | 1 - app/views/pools/edit.html.erb | 1 - app/views/pools/new.html.erb | 1 - 7 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/pool_elements_controller.rb b/app/controllers/pool_elements_controller.rb index 20bf32c3a..0be0fc3b8 100644 --- a/app/controllers/pool_elements_controller.rb +++ b/app/controllers/pool_elements_controller.rb @@ -21,7 +21,7 @@ class PoolElementsController < ApplicationController end def all_select - @pools = Pool.undeleted.where("is_active = true").order("name").select("id, name") + @pools = Pool.undeleted.order("name").select("id, name") @pools.each # hack to force rails to eager load @pools end diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb index ad2ec943c..8ca0bb43d 100644 --- a/app/controllers/pools_controller.rb +++ b/app/controllers/pools_controller.rb @@ -95,7 +95,7 @@ class PoolsController < ApplicationController private def pool_params - permitted_params = %i[name description category is_active post_ids post_ids_string] + permitted_params = %i[name description category post_ids post_ids_string] params.require(:pool).permit(*permitted_params, post_ids: []) end end diff --git a/app/models/pool.rb b/app/models/pool.rb index f2813a7a8..6adb510db 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -62,7 +62,7 @@ class Pool < ApplicationRecord def search(params) q = super - q = q.search_attributes(params, :creator, :is_active, :is_deleted, :name, :description, :post_ids) + q = q.search_attributes(params, :creator, :is_deleted, :name, :description, :post_ids) q = q.text_attribute_matches(:description, params[:description_matches]) if params[:post_tags_match] diff --git a/app/views/pool_versions/search.html.erb b/app/views/pool_versions/search.html.erb index da689feba..dc21d7cb0 100644 --- a/app/views/pool_versions/search.html.erb +++ b/app/views/pool_versions/search.html.erb @@ -9,11 +9,10 @@ <%= f.input :is_new, label: "New?", collection: [["Yes", true], ["No", false]], include_blank: true %> <%= f.input :name_changed, label: "Name changed?", collection: [["Yes", true], ["No", false]], include_blank: true %> <%= f.input :description_changed, label: "Description changed?", collection: [["Yes", true], ["No", false]], include_blank: true %> - <%= f.input :is_active, label: "Active?", collection: [["Yes", true], ["No", false]], include_blank: true %> <%= f.input :is_banned, label: "Deleted?", collection: [["Yes", true], ["No", false]], include_blank: true %> <%= f.submit "Search" %> <% end %> -<%= render "secondary_links" %> \ No newline at end of file +<%= render "secondary_links" %> diff --git a/app/views/pools/_search.html.erb b/app/views/pools/_search.html.erb index 4e8889f3e..de424ed53 100644 --- a/app/views/pools/_search.html.erb +++ b/app/views/pools/_search.html.erb @@ -3,7 +3,6 @@ <%= f.input :description_matches, label: "Description", input_html: { value: params.dig(:search, :description_matches) } %> <%= f.input :post_tags_match, label: "Post tags", input_html: { value: params.dig(:search, :post_tags_match), "data-autocomplete": "tag-query" } %> <%= f.input :creator_name, label: "Creator", input_html: { value: params.dig(:search, :creator_name), "data-autocomplete": "user" } %> - <%= f.input :is_active, label: "Status", as: :select, collection: [%w[Active true], %w[Inactive false]], include_blank: true, selected: params.dig(:search, :is_active) %> <%= f.input :category, collection: %w[series collection], include_blank: true, selected: params[:search][:category] %> <%= f.input :order, collection: [%w[Last\ updated updated_at], %w[Name name], %w[Recently\ created created_at], %w[Post\ count post_count]], include_blank: true, selected: params.dig(:search, :order) %> <%= f.submit "Search" %> diff --git a/app/views/pools/edit.html.erb b/app/views/pools/edit.html.erb index 053fa2e4c..4202226de 100644 --- a/app/views/pools/edit.html.erb +++ b/app/views/pools/edit.html.erb @@ -10,7 +10,6 @@ <%= dtext_preview_button "pool", "description" %> <%= f.input :post_ids_string, as: :text, label: "Posts" %> <%= f.input :category, :collection => ["series", "collection"], :include_blank => false %> - <%= f.input :is_active %> <%= f.button :submit %> <% end %> diff --git a/app/views/pools/new.html.erb b/app/views/pools/new.html.erb index ae2338ce2..165ec4497 100644 --- a/app/views/pools/new.html.erb +++ b/app/views/pools/new.html.erb @@ -9,7 +9,6 @@ <%= dtext_field "pool", "description" %> <%= f.input :post_ids_string, as: :text, label: "Posts" %> <%= f.input :category, :collection => ["series", "collection"], :include_blank => true, :selected => "", :required => true %> - <%= f.input :is_active %> <%= f.button :submit, "Submit" %> <%= dtext_preview_button "pool", "description" %> <% end %>