Sha256: 27968c86cc38f69182395500264e55d33f613499f03a8101630620e520fe26a3

Contents?: true

Size: 730 Bytes

Versions: 62

Compression:

Stored size: 730 Bytes

Contents

module Workarea
  class Storefront::Users::OrdersController < Storefront::ApplicationController
    before_action :require_login

    def index
      models = Order.recent(
        current_user.id,
        Workarea.config.storefront_user_order_display_count
      )
      statuses = Fulfillment.find_statuses(*models.map(&:id))

      @orders = models.map do |order|
        Storefront::OrderViewModel.new(
          order,
          fulfillment_status: statuses[order.id]
        )
      end
    end

    def show
      model = Order.find(params[:id])

      if model.user_id != current_user.id.to_s
        head :forbidden and return
      else
        @order = Storefront::OrderViewModel.new(model)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.26 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.45 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.25 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.23 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.44 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.22 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.43 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.21 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.42 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.20 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.41 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.19 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.40 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.18 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.39 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.17 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.38 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.16 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.37 app/controllers/workarea/storefront/users/orders_controller.rb