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.15 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.36 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.14 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.35 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.13 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.34 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.12 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.33 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.11 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.10 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.32 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.9 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.31 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.8 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.30 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.7 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.29 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.6 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.28 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.5 app/controllers/workarea/storefront/users/orders_controller.rb