Sha256: e1b4ac7329654be4cc98571615e4b9129f3d45a1ac58d9d56800f53fead551ec

Contents?: true

Size: 711 Bytes

Versions: 22

Compression:

Stored size: 711 Bytes

Contents

require 'csv'

module Spree
  module Admin
    class PromotionCodesController < Spree::Admin::ResourceController
      def index
        @promotion = Spree::Promotion.accessible_by(current_ability, :read).find(params[:promotion_id])
        @promotion_codes = @promotion.promotion_codes

        respond_to do |format|
          format.html do
            @promotion_codes = @promotion_codes.page(params[:page]).per(50)
          end
          format.csv do
            filename = "promotion-code-list-#{@promotion.id}.csv"
            headers["Content-Type"] = "text/csv"
            headers["Content-disposition"] = "attachment; filename=\"#{filename}\""
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
solidus_backend-2.5.2 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.5.1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.5.0 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.5.0.rc1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.5.0.beta2 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.5.0.beta1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.4.2 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.4.1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.2.2 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.4.0 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.4.0.rc1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.4.0.beta1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.0 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.0.rc3 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.0.rc2 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.0.rc1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.3.0.beta1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.2.1 app/controllers/spree/admin/promotion_codes_controller.rb
solidus_backend-2.2.0 app/controllers/spree/admin/promotion_codes_controller.rb