Sha256: d319497172224f9b3af7d58606f88164752cab793b60975cd85c8b4041a35173

Contents?: true

Size: 542 Bytes

Versions: 28

Compression:

Stored size: 542 Bytes

Contents

module Workarea
  module Storefront
    class DownloadsController < Storefront::ApplicationController
      def show
        token = Fulfillment::Token.find(params[:id])
        sku = Fulfillment::Sku.find(token.sku) rescue nil

        if token&.enabled? && sku&.downloadable?
          token.inc(downloads: 1)
          send_file sku.file.file, filename: sku.file_name
        else
          flash[:info] = t('workarea.storefront.flash_messages.download_unavailable')
          redirect_to root_path
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.26 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.25 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.23 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.22 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.21 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.20 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.19 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.18 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.17 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.16 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.15 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.14 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.13 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.12 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.11 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.10 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.9 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.8 app/controllers/workarea/storefront/downloads_controller.rb
workarea-storefront-3.5.7 app/controllers/workarea/storefront/downloads_controller.rb