This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/helpers/breadcrumb_helper.rb
2021-09-27 11:20:37 +02:00

36 lines
942 B
Ruby

module BreadcrumbHelper
def breadcrumb(*custom_last_item)
if custom_last_item.present?
first_title_length = @result[:first][:name].to_s.length + 1
@title.slice!(0, first_title_length)
@title << "/" + custom_last_item[0]
end
if @result.present?
capture_haml do
haml_tag :h1 do
haml_concat(link_to @result[:first][:name], @result[:first][:link])
haml_tag :span do
haml_concat(link_to @result[:second][:name], @result[:second][:link])
if custom_last_item.present?
haml_tag :span do
haml_concat(custom_last_item[0])
end
end
end
end
end
else
capture_haml do
haml_tag :h1 do
haml_concat "Erreur dans le BreadcrumbHelper"
end
end
end
end
def breadcrumb_title
@result[:first][:name] + "/" + result[:second][:name]
end
end