Sha256: e17afb5a285e986de651586282e8b7288737bdde66690e82550f9e1ffcb51b93
Contents?: true
Size: 964 Bytes
Versions: 4
Compression:
Stored size: 964 Bytes
Contents
module Workarea decorate Storefront::Users::OrdersController, with: 'legacy_orders' do def index super @orders += legacy_orders end def show model = LegacyOrder.find(params[:id]) rescue nil if model.blank? super return end if model.email.downcase != current_user.email.downcase render nothing: true, status: :forbidden and return else @order = Storefront::LegacyOrderViewModel.wrap(model) render "workarea/storefront/users/legacy_orders/show" end end private def legacy_order_limit Workarea.config.storefront_user_order_display_count - @orders.size end def legacy_order_models return [] unless legacy_order_limit > 0 LegacyOrder .for_email(current_user.email) .limit(legacy_order_limit) end def legacy_orders Storefront::LegacyOrderViewModel.wrap(legacy_order_models) end end end
Version data entries
4 entries across 4 versions & 1 rubygems