Coder Social home page Coder Social logo

Comments (16)

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024 1

Hmmm ok I don't have a multisite test site currently.

I do not have enough time at the moment to create a multisite test site and look into this any further, do please fork the source and if you manage to fix this submit a PR.

I have not had any issues on the multisite setups I have used this on recently.

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024 1

Labels and links should be fully interchangable, and you should also be able to change a link into a label, or a label into a link.

You should also be able to add links and labels as many levels nested below each item.

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024 1

🤯 I wonder what the cause was 🤔

I did fix an issue with the itemType being incorrectly set, so maybe it was that.

Great news though!

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

FYI: this bug is a blocker for us. If it's not resolved soon, we have to fall back to meganav. No pressure, just curious: what's your prognosis about fixing this one?

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024

It's on my list, labels don't exist in MegaNav, I added them as part of the UmbNav migration.

Happy to recieve PRs if things are needed quickly, this is something i support in my spare time for free so all help is appreciated 😇

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024

Following your instructions this is the output I got:

<ul>
    <li>
        <h3>Label A</h3>
        <ul>
            <li>
                <a href="">Label B</a>
                <a>Label B</a>
                <ul>
                    <li>
                        <a href="#linkx">Link X</a>
                        <a href="#linkx#linkx">Link X</a>
                    </li>
                    <li>
                        <a href="#linky" target="_blank">Link Y</a>
                       <a href="#linky#linky" target="_blank">Link Y</a>
                    </li>
                    <li>
                        <a class="linkzclass" href="#linkz">Link Z</a>
                        <a href="#linkz#linkz" class="linkzclass">Link Z</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="">Label C</a>
                 <a>Label C</a>
            </li>
        </ul>
    </li>
</ul>

From what I can see, the only issue is with the label being output as a link, this is as expected as you are calling @item.GetLinkHtml(), I agree this should be handled better as per #16.

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

Here's the literal code I'm using. ANd we still see this on RC10:

@helper BuildSubNavItems(IEnumerable<UmbNavItem> items, int level = 0){
    const int maxDepth = 2;
    int maxItems = 4;

    <ul class="umbnav__list umbnav__list--lvl-@level" data-navlevel="@level" data-navchildren="@items.Count()">
        @foreach (var item in items.Take(maxItems))
        {
            <li class="umbnav__item umbnav__item--lvl-@level @item.CustomClasses">
                @* TO-DO: add ability to do images later. Model will need to be updated, too *@
                @if (String.IsNullOrEmpty(item.Url())) // Hack because it will give type of Link
                {
                    <div tabindex="0" class="umbnav__label @item.CustomClasses">@(String.IsNullOrEmpty(item.Title) ? "Mutated" : item.Title)</div>
                }
                else
                {
                    @item.getLinkHtml()
                    <a href="@item.Url()@item.Anchor" class="@item.CustomClasses" target="@item.Target">@(String.IsNullOrEmpty(item.Title) ? "Mutated" : item.Title)</a>
                }

                @BuildSubNavItems(item.Children, level + 1)
            </li>
        }
    </ul>
}

I tried adding a custom class to every item in the menu. This worked to force all labels to stay labels on recursion. However, it has intermittent results on links. I can't identify the pattern yet. Here, all of the items have a custom class, but for some reason, only one of them remains a link on recursion at level 2.

image

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

With the above code, The output looks like this for Madre de 2. (I need to check that children isn't 0, oops):

I replace URLs with (correct) to make this more readable.

<li class="umbnav__item umbnav__item--lvl-0 avoid-mutation">
  <div tabindex="0" class="umbnav__label avoid-mutation">Madre de 2</div>
  <ul class="umbnav__list umbnav__list--lvl-1" data-navlevel="1" data-navchildren="2">
    <li class="umbnav__item umbnav__item--lvl-1 avoid-mutation">
      <div tabindex="0" class="umbnav__label avoid-mutation">Nivel 1</div>
      <ul class="umbnav__list umbnav__list--lvl-2" data-navlevel="2" data-navchildren="5">
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>
          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>
          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation test-class">
          <a class="avoid-mutation test-class" href="(correct)">Planes (con una clase)</a>          <a href="(correct)" class="avoid-mutation test-class">Planes (con una clase)</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <div tabindex="0" class="umbnav__label avoid-mutation">No pongas etiquetas aquí</div>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
      </ul>
    </li>
    <li class="umbnav__item umbnav__item--lvl-1 avoid-mutation custom-label">
      <div tabindex="0" class="umbnav__label avoid-mutation custom-label">Nivel 1 (con una clase)</div>
      <ul class="umbnav__list umbnav__list--lvl-2" data-navlevel="2" data-navchildren="4">
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
        <li class="umbnav__item umbnav__item--lvl-2 avoid-mutation">
          <a class="avoid-mutation" href="(correct)"></a>          <a href="(correct)" class="avoid-mutation">Mutated</a>
          <ul class="umbnav__list umbnav__list--lvl-3" data-navlevel="3" data-navchildren="0">
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</li>

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024

When a link is entered into the backoffice it's stored in the property json, and as such is stored within the Umbraco cache.

When a node is chosen in the backoffice this is also stored in the property json, however the model get's the latest information from the cache at render using either the Guid / Id or Udi depending on what's stored.

At this point I can only come to the conclusion that this is a cache issue within the site, and my suggestion is to rebuild the indexes and clear out the TempData folder within AppData.

Failing that as a last resort rebuilding the menu in the backoffice by removing all links, save and publish and then adding the links back in again will create a fresh json blob.

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

Will try

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

FYI: I deleted app_data, cleared, the cache, and built a new test menu from scratch. The mutation still occurs for us as above.

We are using a Multi Site setup, which might affect trying to duplicate the error.

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

One more question on this and I'll stop being annoying: I just realized that maybe you built this without intending labels to have link children. But perhaps the new feature will be a workaround for it?

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024

If you could provide a site mirroring your setup, using a starterkit that can demo this issue in a way I can debug it, then that would be useful.

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

Installing RC11 fixed the mutation.

from our.umbraco.umbnav.

tzbarkan avatar tzbarkan commented on June 3, 2024

I celebrated too soon: rc11 works with menus made with rc10, but it there are new issues for us. Creating a new menu in rc11 with labels, or editing an existing menu with labels causes the entire item to have zero children. Now even top level labels are gone. rc11 only works for us if the menu is made completely of links. (I haven't tried images).

The new display-as-label feature bypasses this bug in our setup.

I know I need to give you a way to replicate, but just documenting the info here in case it becomes useful. :)

from our.umbraco.umbnav.

AaronSadlerUK avatar AaronSadlerUK commented on June 3, 2024

Thats strange, my thoughts are it must be due to the recursive call in the builder service.

Once i have something to test with it would be good to resolve this

from our.umbraco.umbnav.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.