bullet-train-co / bullet_train-core

The Open Source Ruby on Rails SaaS Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider using `link_to_unless_current` for conditional links in breadcrumbs

olbrich opened this issue · comments

<% if url && url != request.url %>
<%= link_to label, url, class: "#{item_style} hover:text-slate-700 hover:underline dark:text-primary-300" %>
<% else %>
<span class="<%= item_style %>"><%= label %></span>
<% end %>

Could become...

    <%= link_to_unless_current(label, url, class: "#{item_style} hover:text-slate-700 hover:underline dark:text-primary-300") do %>
       <span class="<%= item_style %>"><%= label %></span> 
    <% end %> 

This is purely a style thing.

I think we should probably leave this alone unless it's causing problems. As it stands now you get either an a tag with text inside it OR a span tag with text inside it, but the proposed change would result in sometimes getting span => text and sometimes getting a => span => text. That might cause problems if people have written custom CSS to target the breadcrumbs.

Happy to revisit this if there's a reason to do so.