Sha256: 6122bdaf2df974938dace63e2d7bdedc60c82b557e47a777832365d9764f56ec

Contents?: true

Size: 1.12 KB

Versions: 62

Compression:

Stored size: 1.12 KB

Contents

module Workarea
  module Storefront
    module ProductsHelper
      def truncated_product_description(product, text)
        truncate(strip_tags(product.description), length: 200) do
          link_to(
            text,
            product_path(
              product,
              params: product.browse_link_options,
              anchor: 'description'
            ),
            data: {
              scroll_to_button: ''
            }
          )
        end
      end

      def option_label(option)
        if option.current.present?
          "#{option.name}: #{option.current}"
        else
          option.name
        end
      end

      def option_selection_url_for(product, option, selection)
        selection_value = option.current == selection ? nil : selection
        product.currently_selected_options.merge(
          option.slug => selection_value,
          id: product.slug,
          via: params[:via]
        )
      end

      def intrinsic_ratio_product_image_styles(image)
        return if image.inverse_aspect_ratio.blank?
        "padding-bottom: #{image.inverse_aspect_ratio * 100}%;"
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.15 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.36 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.14 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.35 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.13 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.34 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.12 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.33 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.11 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.10 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.32 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.9 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.31 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.8 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.30 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.7 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.29 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.6 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.28 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.5 app/helpers/workarea/storefront/products_helper.rb