Sha256: c2a46b7d377d3b1d463cb581ad902b315048e0b327da48c25903c36e20e3be34

Contents?: true

Size: 777 Bytes

Versions: 9

Compression:

Stored size: 777 Bytes

Contents

module Spree
  module Admin
    class AdjustmentsController < ResourceController

      belongs_to 'spree/order', find_by: :number

      create.after :update_totals
      destroy.after :update_totals
      update.after :update_totals

      skip_before_filter :load_resource, only: [:toggle_state, :edit, :update, :destroy]

      before_action :find_adjustment, only: [:destroy, :edit, :update]

      def index
        @adjustments = @order.all_adjustments.order("created_at ASC")
      end

      private

      def find_adjustment
        # Need to assign to @object here to keep ResourceController happy
        @adjustment = @object = parent.all_adjustments.find(params[:id])
      end

      def update_totals
        @order.reload.update!
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_backend-2.2.14 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.13 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.12 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.11 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.10 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.9 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.8 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.2.7 app/controllers/spree/admin/adjustments_controller.rb
spree_backend-2.3.4 app/controllers/spree/admin/adjustments_controller.rb