Module: C::StorefrontHelper
- Defined in:
- app/helpers/c/storefront_helper.rb
Instance Method Summary collapse
- #category_root_menu ⇒ Object
- #menu(menu_item_name, depth = 1) ⇒ Object
- #menu_items_for(menu_item_name, depth = 1) ⇒ Object
- #meta_description ⇒ Object
- #meta_tags ⇒ Object
- #page_title ⇒ Object
- #sales_highlights(page) ⇒ Object
- #slideshow(slideshow_name, klass = nil) ⇒ Object
Instance Method Details
#category_root_menu ⇒ Object
18 19 20 21 22 |
# File 'app/helpers/c/storefront_helper.rb', line 18 def content_tag :ul do render partial: 'c/front/application/category_item', collection: C::Category.find_all_by_generation(0) end end |
#menu(menu_item_name, depth = 1) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/c/storefront_helper.rb', line 4 def (, depth=1) return unless ( = C::MenuItem.find_by(machine_name: )) return unless .children.any? content_tag :ul do render partial: 'c/front/application/menu_item', collection: .children.includes(:page), cached: true, locals: { depth: depth } end end |
#menu_items_for(menu_item_name, depth = 1) ⇒ Object
12 13 14 15 16 |
# File 'app/helpers/c/storefront_helper.rb', line 12 def (, depth=1) return unless ( = C::MenuItem.find_by(machine_name: )) return unless .children.any? render partial: 'c/front/application/menu_item', collection: .children.includes(:page), cached: true, locals: { depth: depth } end |
#meta_description ⇒ Object
40 41 42 43 |
# File 'app/helpers/c/storefront_helper.rb', line 40 def return unless @page_info&.&.present? tag :meta, name: :description, content: @page_info. end |
#meta_tags ⇒ Object
24 25 26 |
# File 'app/helpers/c/storefront_helper.rb', line 24 def safe_join([page_title, ]) if @page_info end |
#page_title ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/c/storefront_helper.rb', line 28 def page_title if @page_info.title.blank? if @page_info.fallback_title.blank? content_tag(:title, C.store_name) else content_tag(:title, @page_info.fallback_title) end else content_tag(:title, @page_info.title) end end |
#sales_highlights(page) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'app/helpers/c/storefront_helper.rb', line 54 def sales_highlights(page) case page when :home render partial: 'c/front/application/sales_highlight', collection: C::SalesHighlight.first(4), cached: true when :store render partial: 'c/front/application/sales_highlight', collection: C::SalesHighlight.first(3), cached: true end end |
#slideshow(slideshow_name, klass = nil) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/helpers/c/storefront_helper.rb', line 45 def (, klass=nil) return 'No slideshow found' unless ( = C::Slideshow.find_by(machine_name: )) content_tag :div, class: :slideshow do content_tag :ul do render partial: 'c/front/application/slide', collection: ..ordered, cached: true, locals: { klass: klass } end end end |