Sha256: ea7e952d1a64f9f753c5f35d9274684cf8cc10267e6b2bb4504d2dae039e4bce

Contents?: true

Size: 778 Bytes

Versions: 7

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

module Spree
  module Admin
    class SubscriptionOrdersController < ResourceController
      belongs_to 'subscription', model_class: SolidusSubscriptions::Subscription

      def index
        @search = collection.ransack((params[:q] || {}).reverse_merge(s: 'created_at desc'))

        @subscription_orders = @search.result(distinct: true).
                               page(params[:page]).
                               per(params[:per_page] || 20)
      end

      private

      def model_class
        ::Spree::Order
      end

      def find_resource
        parent.orders.find(params[:id])
      end

      def build_resource
        parent.orders.build
      end

      def collection
        parent.orders
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-2.0.1 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-2.0.0 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-1.1.0 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-1.0.1 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-1.0.0 app/controllers/spree/admin/subscription_orders_controller.rb
solidus_subscriptions-1.0.0.rc1 app/controllers/spree/admin/subscription_orders_controller.rb