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.27 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.26 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.25 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.23 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.22 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.21 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.20 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.19 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.18 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.17 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.16 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.15 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.14 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.13 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.12 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.11 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.10 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.9 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.8 app/helpers/workarea/admin/products_helper.rb
workarea-admin-3.5.7 app/helpers/workarea/admin/products_helper.rb