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.
This commit is contained in:
evazion
2020-01-12 00:59:36 -06:00
parent 3fce17d8ae
commit bebc4694dd
7 changed files with 4 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ class PoolElementsController < ApplicationController
end end
def all_select 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.each # hack to force rails to eager load
@pools @pools
end end

View File

@@ -95,7 +95,7 @@ class PoolsController < ApplicationController
private private
def pool_params 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: []) params.require(:pool).permit(*permitted_params, post_ids: [])
end end
end end

View File

@@ -62,7 +62,7 @@ class Pool < ApplicationRecord
def search(params) def search(params)
q = super 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]) q = q.text_attribute_matches(:description, params[:description_matches])
if params[:post_tags_match] if params[:post_tags_match]

View File

@@ -9,11 +9,10 @@
<%= f.input :is_new, label: "New?", collection: [["Yes", true], ["No", false]], include_blank: true %> <%= 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 :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 :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.input :is_banned, label: "Deleted?", collection: [["Yes", true], ["No", false]], include_blank: true %>
<%= f.submit "Search" %> <%= f.submit "Search" %>
<% end %> <% end %>
</div> </div>
</div> </div>
<%= render "secondary_links" %> <%= render "secondary_links" %>

View File

@@ -3,7 +3,6 @@
<%= f.input :description_matches, label: "Description", input_html: { value: params.dig(:search, :description_matches) } %> <%= 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 :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 :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 :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.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" %> <%= f.submit "Search" %>

View File

@@ -10,7 +10,6 @@
<%= dtext_preview_button "pool", "description" %> <%= dtext_preview_button "pool", "description" %>
<%= f.input :post_ids_string, as: :text, label: "Posts" %> <%= f.input :post_ids_string, as: :text, label: "Posts" %>
<%= f.input :category, :collection => ["series", "collection"], :include_blank => false %> <%= f.input :category, :collection => ["series", "collection"], :include_blank => false %>
<%= f.input :is_active %>
<%= f.button :submit %> <%= f.button :submit %>
<% end %> <% end %>
</div> </div>

View File

@@ -9,7 +9,6 @@
<%= dtext_field "pool", "description" %> <%= dtext_field "pool", "description" %>
<%= f.input :post_ids_string, as: :text, label: "Posts" %> <%= f.input :post_ids_string, as: :text, label: "Posts" %>
<%= f.input :category, :collection => ["series", "collection"], :include_blank => true, :selected => "", :required => true %> <%= f.input :category, :collection => ["series", "collection"], :include_blank => true, :selected => "", :required => true %>
<%= f.input :is_active %>
<%= f.button :submit, "Submit" %> <%= f.button :submit, "Submit" %>
<%= dtext_preview_button "pool", "description" %> <%= dtext_preview_button "pool", "description" %>
<% end %> <% end %>