Breadcrumbs - How To ?:

Hi All,

I'm just trying to figure out where:
  • breadcrumb
  • title 

Come from in the below code, I've setup a new model and trying to get breadcrumb and title to work but I can't find where this is actually coming from ?

There doesn't seem to be anything in the Accounts Controller that actually sets this ?

image.png 18.7 KB


# views/accounts/new.html.erb
<div class="flex flex-wrap my-4 lg:px-4">
  <div class="lg:w-1/4 w-full p-4">
    <%= render partial: "shared/account_navbar" %>
  </div>

  <div class="lg:w-3/4 w-full p-4">
    <div class="text-sm text-gray-600 mb-5">
      <%= link_to t("accounts.all"), accounts_path, class: "hover:text-black" %>
      <%= render_svg "icons/cheveron-right", styles: "fill-current icon-sm text-gray-600 inline-block" %>
      <%= t(".breadcrumb") %>
    </div>

    <div class="lg:p-10 p-4 bg-white rounded-lg border border-gray-300">
      <h1><%= t(".title") %></h1>

      <%= render 'form', account: @account %>

      <%= link_to t("back"), accounts_path %>
    </div>
  </div>
</div>

John Quarto-vonTivadar
look for "breadcrumb' in the config/locales/en.yml file (or similar). It's a localization file.   the keys in the .yml file are tied to the controllers/actions so there are variables set specifically for it.

a snippet:

Screen Shot 2021-06-22 at 11.12.39 AM.png 162 KB

the specific one you're referring to is for the "accounts" controller, and the "new" action. It sets a variable named "breadcrumb" which should have a value of "New Account".      However in your screenshot, it looks like the values are incorrect. Since it's not erroring, my first guess is the en.yml has been modified
Thanks so much John Quarto-vonTivadar

That did the trick :)

image.png 23.7 KB


image.png 93.1 KB





Notifications
You’re not receiving notifications from this thread.
Subscribe
© 2021 GoRails, LLC