Sha256: 45021140a82e0a6d58848fd191f8ad7bde7bb0f87001bf5be5e7143f3aadce61

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

module Spree
  module Admin
    class ReturnIndexController < BaseController
      def return_authorizations
        collection(Spree::ReturnAuthorization.for_store(current_store))
        respond_with(@collection)
      end

      def customer_returns
        collection(current_store.customer_returns)
        respond_with(@collection)
      end

      private

      def collection(resource)
        return @collection if @collection.present?

        params[:q] ||= {}

        # @search needs to be defined as this is passed to search_form_for
        @search = resource.ransack(params[:q])
        per_page = params[:per_page] || Spree::Backend::Config[:admin_customer_returns_per_page]
        @collection = @search.result.order(created_at: :desc).page(params[:page]).per(per_page)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_backend-4.4.1 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.4.0 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.4.0.rc2 app/controllers/spree/admin/return_index_controller.rb