pools: remove recent pools from 'add to pool' dialog.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user