Sha256: 94ebc80698729fc524a7e6b1573900121a21656f2f0d97ecd9ac1a6ce2177498

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module Workarea
  decorate Storefront::OrderItemViewModel,
           Admin::OrderItemViewModel, with: :gift_wrapping do

    def gift_wrap_id
      gift_wraps.first.try(:id).to_s
    end

    def gift_wraps
      @gift_wraps ||= gift_wraps_attributes.map do |attr|
        Mongoid::Factory.from_db(Catalog::GiftWrap, attr)
      end
    end

    def gift_wrapped?
      gift_wrap_quantities.present?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-gift_wrapping-1.3.0 app/view_models/workarea/order_item_view_model.decorator
workarea-gift_wrapping-1.2.1 app/view_models/workarea/order_item_view_model.decorator