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.4.27 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.4 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.26 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.3 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.25 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.2 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.24 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.1 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.23 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.22 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.0 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.21 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.5.0.beta.1 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.20 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.19 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.18 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.17 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.16 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.15 app/controllers/workarea/storefront/users/orders_controller.rb
workarea-storefront-3.4.14 app/controllers/workarea/storefront/users/orders_controller.rb