diff options
Diffstat (limited to 'app/helpers/breadcrumbs_helper.rb')
-rw-r--r-- | app/helpers/breadcrumbs_helper.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers/breadcrumbs_helper.rb b/app/helpers/breadcrumbs_helper.rb new file mode 100644 index 00000000000..abe8edd6a8c --- /dev/null +++ b/app/helpers/breadcrumbs_helper.rb @@ -0,0 +1,25 @@ +module BreadcrumbsHelper + def add_to_breadcrumbs(text, link) + @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 + + def breadcrumb_title(title) + return if defined?(@breadcrumb_title) + + @breadcrumb_title = title + end +end |