pools: remove recent pools from 'add to pool' dialog.

This commit is contained in:
evazion
2020-01-11 20:11:35 -06:00
parent abacc8ebb1
commit 1e3c97e43b
3 changed files with 0 additions and 31 deletions

View File

@@ -8,7 +8,6 @@ class PoolElementsController < ApplicationController
if @pool.present? && !@pool.is_deleted?
@post = Post.find(params[:post_id])
@pool.add!(@post)
append_pool_to_session(@pool)
else
@error = "That pool does not exist"
end
@@ -26,13 +25,4 @@ class PoolElementsController < ApplicationController
@pools.each # hack to force rails to eager load
@pools
end
private
def append_pool_to_session(pool)
recent_pool_ids = session[:recent_pool_ids].to_s.scan(/\d+/)
recent_pool_ids << pool.id.to_s
recent_pool_ids = recent_pool_ids.slice(1, 5) if recent_pool_ids.size > 5
session[:recent_pool_ids] = recent_pool_ids.uniq.join(",")
end
end

View File

@@ -1,10 +0,0 @@
module PoolsHelper
def recent_updated_pools
pool_ids = session[:recent_pool_ids].to_s.scan(/\d+/)
if pool_ids.any?
Pool.where(["id IN (?)", pool_ids])
else
[]
end
end
end

View File

@@ -11,14 +11,3 @@
<%= submit_tag "Submit" %>
</div>
<% end %>
<% if recent_updated_pools.any? %>
<div>
<h1>Recent Pools</h1>
<ul id="recent-pools">
<% recent_updated_pools.each do |pool| %>
<%= content_tag :li, pool.pretty_name, "data-value" => pool.name %>
<% end %>
</ul>
</div>
<% end %>