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.4.27 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.4 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.26 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.3 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.25 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.2 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.24 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.1 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.23 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.22 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.0 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.21 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.5.0.beta.1 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.20 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.19 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.18 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.17 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.16 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.15 app/helpers/workarea/storefront/products_helper.rb
workarea-storefront-3.4.14 app/helpers/workarea/storefront/products_helper.rb