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
|
|
|
|
|
|
|
|
if controller.available_action?(:index)
|
|
|
|
url_for(action: "index")
|
|
|
|
else
|
|
|
|
request.path
|
|
|
|
end
|
|
|
|
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-06 06:55:23 -04:00
|
|
|
link + icon("angle-right", 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
|