Sha256: 336582ec85c0e17454d9a1f2c62fdcd44677c5709d6a8c9c8c27650a89f96ab1

Contents?: true

Size: 751 Bytes

Versions: 28

Compression:

Stored size: 751 Bytes

Contents

module Workarea
  module Admin::ProductsHelper
    def format_variant_options(hash)
      hash.map do |name, value|
        joined = value.is_a?(Array) ? value.join(', ') : value
        "#{content_tag(:strong, name)}: #{joined}"
      end.join(', ').html_safe
    end

    def summary_inventory_status_css_classes(product)
      status_issue_class =
        if !product.active?
          'product-summary--inactive'
        elsif !product.inventory.available?
          "product-summary--#{product.inventory.status.to_s.dasherize}"
        end

      return [] unless status_issue_class.present?
      return [] if product.inventory.any?(&:displayable_when_out_of_stock?)
      [status_issue_class, 'product-summary--status-issue']
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.6 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.5 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.4 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.3 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.2 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.1 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.0 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.0.beta.1 app/helpers/workarea/admin/products_helper.rb