2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-06 12:24:03 -04:00
|
|
|
module BreadcrumbsHelper
|
2017-07-07 16:50:34 -04:00
|
|
|
def add_to_breadcrumbs(text, link)
|
2017-07-06 12:24:03 -04:00
|
|
|
@breadcrumbs_extra_links ||= []
|
|
|
|
@breadcrumbs_extra_links.push({
|
|
|
|
text: text,
|
|
|
|
link: link
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
def breadcrumb_title_link
|
|
|
|
return @breadcrumb_link if @breadcrumb_link
|
|
|
|
|
2017-09-27 11:22:12 -04:00
|
|
|
request.path
|
2017-07-06 12:24:03 -04:00
|
|
|
end
|
2017-07-12 04:16:32 -04:00
|
|
|
|
|
|
|
def breadcrumb_title(title)
|
|
|
|
return if defined?(@breadcrumb_title)
|
|
|
|
|
|
|
|
@breadcrumb_title = title
|
|
|
|
end
|
2017-08-16 05:35:59 -04:00
|
|
|
|
|
|
|
def breadcrumb_list_item(link)
|
|
|
|
content_tag "li" do
|
2017-09-28 09:43:52 -04:00
|
|
|
link + sprite_icon("angle-right", size: 8, css_class: "breadcrumbs-list-angle")
|
2017-08-16 05:35:59 -04:00
|
|
|
end
|
|
|
|
end
|
2017-08-16 08:13:34 -04:00
|
|
|
|
|
|
|
def add_to_breadcrumb_dropdown(link, location: :before)
|
|
|
|
@breadcrumb_dropdown_links ||= {}
|
2017-09-06 06:55:23 -04:00
|
|
|
@breadcrumb_dropdown_links[location] ||= []
|
2017-08-16 08:13:34 -04:00
|
|
|
@breadcrumb_dropdown_links[location] << link
|
|
|
|
end
|
2017-07-06 12:24:03 -04:00
|
|
|
end
|