Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested TrimEmptyGroupingNodesVisibilityProvider #375

Closed
Kaneraz opened this issue Dec 10, 2014 · 1 comment
Closed

Nested TrimEmptyGroupingNodesVisibilityProvider #375

Kaneraz opened this issue Dec 10, 2014 · 1 comment

Comments

@Kaneraz
Copy link

Kaneraz commented Dec 10, 2014

When nesting TrimEmptyGroupingNodesVisibilityProvider it fails to trim the parent node.

<mvcSiteMapNode title="Catalog" visibilityProvider="MvcSiteMapProvider.TrimEmptyGroupingNodesVisibilityProvider, MvcSiteMapProvider" clickable="false">
    <mvcSiteMapNode title="Parts" visibilityProvider="MvcSiteMapProvider.TrimEmptyGroupingNodesVisibilityProvider, MvcSiteMapProvider" clickable="false" >
        <mvcSiteMapNode title="Search"  area="Materials" controller="Parts" action="Search" />
        <mvcSiteMapNode title="Add"  area="Materials" controller="Parts" action="Add" />
    </mvcSiteMapNode>
    <mvcSiteMapNode title="Assets"  area="Materials" controller="Asset" action="Search" />
</mvcSiteMapNode>

When it gets to the parent node the 2nd one is just hidden not trimmed so it has child nodes.

@Kaneraz
Copy link
Author

Kaneraz commented Dec 10, 2014

I rolled my own visibility provider to fix it and overrode IsVisible as follows:

public override bool IsVisible(ISiteMapNode node, IDictionary<string, object> sourceMetadata)
        {
            var childNodes = node.ChildNodes;
            return childNodes == null || childNodes.Any(c => c.IsVisible(sourceMetadata)) || node.Clickable;
        }

I'll see if I can get set up to push a patch for it and add some tests to update the built in provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants