piotrmurach / loaf

Manages and displays breadcrumb trails in Rails app - lean & mean.
MIT License
406 stars 24 forks source link

breadcrumb_trail options has no effect #43

Closed molfar closed 3 years ago

molfar commented 4 years ago

Passing any match options to breadcrumb_trail inside views has no effect.

<% breadcrumb_trail match: :exact do |crumb| %>
  <%= link_to_unless crumb.current?, crumb.name, crumb.url, class: 'text-gray-700 underline' %>
  <% unless crumb.current? %><span>::</span><% end %>
<% end %>
molfar commented 4 years ago

https://github.com/piotrmurach/loaf/blob/6a8d586d3a49b4e524be425dee86d5def8eb79f1/spec/unit/view_extensions/breadcrumb_trail_spec.rb#L237

Changing this line to view.breadcrumb_trail(&block) or to view.breadcrumb_trail(match: : inclusive, &block) # any other valid match value does not make test fail

piotrmurach commented 4 years ago

Hi! Thanks for this report. This sounds like a bug. Would you have time to submit a fix with a test?

molfar commented 4 years ago

I cant catch this bug yet, I arrived to https://github.com/piotrmurach/loaf/blob/6a8d586d3a49b4e524be425dee86d5def8eb79f1/lib/loaf/view_extensions.rb#L90 This regex works not as expected. It doesn not show that "/" is active within "/posts". Thats why test "allows to overwrite global configuration" not failing.