Sha256: e2beaa8fc37e36eddc9b4e40b69a6eeb18dfec8a4dea03d22cc0e0161a0599f4

Contents?: true

Size: 888 Bytes

Versions: 112

Compression:

Stored size: 888 Bytes

Contents

module Spree
  module Admin
    module AdjustmentsHelper
      def display_adjustable(adjustable)
        case adjustable
        when Spree::LineItem
          display_line_item(adjustable)
        when Spree::Shipment
          display_shipment(adjustable)
        when Spree::Order
          display_order(adjustable)
        end
      end

      private

      def display_line_item(line_item)
        variant = line_item.variant
        parts = []
        parts << variant.product.name
        parts << "(#{variant.options_text})" if variant.options_text.present?
        parts << line_item.display_total
        safe_join(parts, '<br />'.html_safe)
      end

      def display_shipment(shipment)
        "#{Spree.t(:shipment)} ##{shipment.number}<br>#{shipment.display_cost}".html_safe
      end

      def display_order(_order)
        Spree.t(:order)
      end
    end
  end
end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
spree_backend-4.8.4 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.8.3 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.8.2 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.8.1 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.0.9 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.1.15 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.2.7 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.3.3 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.7.2 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.6.2 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.7.1 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.7.0 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.6.1 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.6.0 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.5.1 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.5.0 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.2.6 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.3.2 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.4.1 app/helpers/spree/admin/adjustments_helper.rb
spree_backend-4.4.0 app/helpers/spree/admin/adjustments_helper.rb