Sha256: 925980dc78200833674f50167e30a067c113ad7de60ab63ac22144e08b92453f

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

module Comable
  module ProductsHelper
    def listed_categories(categories, options = {})
      content_tag(options[:tag] || :ul, class: options[:class]) do
        categories.map do |category|
          content_tag(:li, link_to_category(category), class: "#{'active' if @category == category}")
        end.join.html_safe
      end
    end

    def link_to_category(category, force_link: false)
      if force_link || @category != category
        link_to category.name, comable.products_path(category_id: category.id)
      else
        category.name
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
comable-core-0.7.1 app/helpers/comable/products_helper.rb
comable-core-0.7.0 app/helpers/comable/products_helper.rb
comable-core-0.7.0.beta2 app/helpers/comable/products_helper.rb
comable-core-0.7.0.beta1 app/helpers/comable/products_helper.rb