Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused XHR code #3642

Merged
merged 1 commit into from
May 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions backend/app/controllers/spree/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,11 @@ def model_class

def collection
return @collection if @collection
if request.xhr? && params[:q].present?
@collection = Spree.user_class.includes(:bill_address, :ship_address)
.where("#{Spree.user_class.table_name}.email #{LIKE} :search
OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.bill_address_id)
OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.bill_address_id)
OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.ship_address_id)
OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.ship_address_id)",
{ search: "#{params[:q].strip}%" })
.limit(params[:limit] || 100)
else
@search = Spree.user_class.ransack(params[:q])
@collection = @search.result.includes(:spree_roles)
@collection = @collection.includes(:spree_orders)
@collection = @collection.page(params[:page]).per(Spree::Config[:admin_products_per_page])
end

@search = Spree.user_class.ransack(params[:q])
@collection = @search.result.includes(:spree_roles)
@collection = @collection.includes(:spree_orders)
@collection = @collection.page(params[:page]).per(Spree::Config[:admin_products_per_page])
end

def user_params
Expand Down