Sha256: 27c8cb5f50752c1ccde90c2cb953806bc410f5a2273cf708f030ea3e8cfe2b33

Contents?: true

Size: 991 Bytes

Versions: 14

Compression:

Stored size: 991 Bytes

Contents

module Spree
  module Admin
    class PromotionsController < ResourceController
      before_filter :load_data

      helper 'spree/promotion_rules'

      protected
        def location_after_save
          spree.edit_admin_promotion_url(@promotion)
        end

        def load_data
          @calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
        end

        def collection
          return @collection if defined?(@collection)
          params[:q] ||= HashWithIndifferentAccess.new
          params[:q][:s] ||= 'id desc'

          @collection = super
          @search = @collection.ransack(params[:q])
          @collection = @search.result(distinct: true).
            includes(promotion_includes).
            page(params[:page]).
            per(params[:per_page] || Spree::Config[:promotions_per_page])

          @collection
        end

        def promotion_includes
          [:promotion_actions]
        end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
spree_backend-2.3.13 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.12 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.11 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.10 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.9 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.8 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.7 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.6 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.5 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.4 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.3 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.2 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.1 app/controllers/spree/admin/promotions_controller.rb
spree_backend-2.3.0 app/controllers/spree/admin/promotions_controller.rb