Module: BreadcrumbsHelper
- Defined in:
- app/helpers/breadcrumbs_helper.rb
Instance Method Summary collapse
- #add_to_breadcrumb_collapsed_links(link, location: :before) ⇒ Object
- #add_to_breadcrumbs(text, link) ⇒ Object
- #breadcrumb_list_item(link) ⇒ Object
- #breadcrumb_title(title) ⇒ Object
- #breadcrumb_title_link ⇒ Object
- #push_to_schema_breadcrumb(text, link) ⇒ Object
- #schema_breadcrumb_json ⇒ Object
Instance Method Details
#add_to_breadcrumb_collapsed_links(link, location: :before) ⇒ Object
30 31 32 33 34 |
# File 'app/helpers/breadcrumbs_helper.rb', line 30 def (link, location: :before) @breadcrumb_collapsed_links ||= {} @breadcrumb_collapsed_links[location] ||= [] @breadcrumb_collapsed_links[location] << link end |
#add_to_breadcrumbs(text, link) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/breadcrumbs_helper.rb', line 4 def (text, link) @breadcrumbs_extra_links ||= [] @breadcrumbs_extra_links.push({ text: text, link: link }) end |
#breadcrumb_list_item(link) ⇒ Object
24 25 26 27 28 |
# File 'app/helpers/breadcrumbs_helper.rb', line 24 def (link) content_tag "li" do link + sprite_icon("chevron-lg-right", size: 8, css_class: "breadcrumbs-list-angle") end end |
#breadcrumb_title(title) ⇒ Object
18 19 20 21 22 |
# File 'app/helpers/breadcrumbs_helper.rb', line 18 def (title) return if defined?(@breadcrumb_title) @breadcrumb_title = title end |
#breadcrumb_title_link ⇒ Object
12 13 14 15 16 |
# File 'app/helpers/breadcrumbs_helper.rb', line 12 def return @breadcrumb_link if @breadcrumb_link request.fullpath end |
#push_to_schema_breadcrumb(text, link) ⇒ Object
36 37 38 39 40 |
# File 'app/helpers/breadcrumbs_helper.rb', line 36 def (text, link) list_item = schema_list_item(text, link, .size + 1) .push(list_item) end |
#schema_breadcrumb_json ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/helpers/breadcrumbs_helper.rb', line 42 def { '@context': 'https://schema.org', '@type': 'BreadcrumbList', 'itemListElement': build_item_list_elements }.to_json end |