BigW Consortium Gitlab

breadcrumbs_helper.rb 491 Bytes
Newer Older
1
module BreadcrumbsHelper
Phil Hughes committed
2
  def add_to_breadcrumbs(text, link)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    @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
19 20 21 22 23 24

  def breadcrumb_title(title)
    return if defined?(@breadcrumb_title)

    @breadcrumb_title = title
  end
25
end