Module: Comable::ProductsHelper
- Defined in:
- app/helpers/comable/products_helper.rb
Instance Method Summary collapse
- #link_to_category(category, force_link: false) ⇒ Object
- #listed_categories(categories, options = {}) ⇒ Object
Instance Method Details
#link_to_category(category, force_link: false) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/helpers/comable/products_helper.rb', line 11 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 |
#listed_categories(categories, options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/comable/products_helper.rb', line 3 def listed_categories(categories, = {}) content_tag([:tag] || :ul, class: [:class]) do categories.map do |category| content_tag(:li, link_to_category(category), class: "#{'active' if @category == category}") end.join.html_safe end end |