Sha256: beff3b16b3243e4054ccf8f5311853097b7244f748008bb93ef2381d45e53bfa

Contents?: true

Size: 821 Bytes

Versions: 7

Compression:

Stored size: 821 Bytes

Contents

module Spree
  module Admin
    class ReturnIndexController < BaseController
      def return_authorizations
        collection(Spree::ReturnAuthorization)
        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] ||= {}

        @collection = resource.all
        # @search needs to be defined as this is passed to search_form_for
        @search = @collection.ransack(params[:q])
        per_page = params[:per_page] || Spree::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

7 entries across 7 versions & 1 rubygems

Version Path
spree_backend-4.3.3 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.2 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.1 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.0 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.0.rc3 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.0.rc2 app/controllers/spree/admin/return_index_controller.rb
spree_backend-4.3.0.rc1 app/controllers/spree/admin/return_index_controller.rb