Add search form for Admin::BudgetInvestments (#2336)

This commit is contained in:
Angel Perez
2018-01-24 08:58:32 -04:00
parent c08edf044d
commit 680ca46ef1
6 changed files with 47 additions and 2 deletions

View File

@@ -53,8 +53,12 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
private
def load_investments
@investments = Budget::Investment.scoped_filter(params, @current_filter)
.order(cached_votes_up: :desc, created_at: :desc)
if params[:project_title].present?
@investments = Budget::Investment.where("title ILIKE ?", "%#{params[:project_title].strip}%")
else
@investments = Budget::Investment.scoped_filter(params, @current_filter)
.order(cached_votes_up: :desc, created_at: :desc)
end
@investments = @investments.page(params[:page]) unless request.format.csv?
end