Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christian Koch 9 posts 79 karma points
    24 days ago
    Christian Koch
    0

    Bug in partial view snippet for navigation

    The snippet for navigation in U8 is generated as followed

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using Umbraco.Web
    
    
    @*
        This snippet displays a list of links of the pages immediately under the top-most page in the content tree.
        This is the home page for a standard website.
        It also highlights the current active page/section in the navigation with the CSS class "current".
    *@
    
    @{ var selection = Model.Root().Children.Where(x => x.IsVisible()).ToArray(); }
    
    @if (selection.Length > 0)
    {
        <ul>
            @foreach (var item in selection)
            {
                <li class="@(item.IsAncestorOrSelf(Model.Content) ? "current" : null)">
                    <a href="@item.Url">@item.Name</a>
                </li>
            }
        </ul>
    }
    

    Here seems to be a bug. In Umbraco 8 the RenderModel has been removed, so it is no longer Model.Content just Model.

            <li class="@(item.IsAncestorOrSelf(Model.Content) ? "current" : null)">
    

    Therefore correct should be

            <li class="@(item.IsAncestorOrSelf(Model) ? "current" : null)">
    

    Am I right?

  • Søren Kottal 396 posts 2389 karma points MVP c-trib
    19 days ago
    Søren Kottal
    0

    Hi Christian

    Yes, Model is the equivalent of Model.Content fro v7s UmbracoTemplatePage :)

Please Sign in or register to post replies

Write your reply to:

Draft