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.27 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.26 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.45 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.25 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.23 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.44 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.22 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.43 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.21 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.42 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.20 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.41 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.19 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.40 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.18 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.39 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.17 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.38 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.16 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.37 app/helpers/workarea/storefront/products_helper.rb