Example #1
0
        // TODO -- this could really use some more end to end testing
        public MenuItemToken BuildToken(MenuNode node)
        {
            var token = new MenuItemToken {
                Children = node.Children.Select(BuildToken).ToArray(),
                Key      = node.Key.Key,
                Text     = node.Key.ToString(),

                MenuItemState = _stateService.DetermineStateFor(node)
            };

            if (node.Icon().IsNotEmpty())
            {
                token.IconUrl = _urls.UrlForAsset(AssetFolder.images, node.Icon());
            }

            if (node.Type == MenuNodeType.Leaf)
            {
                token.Url = _request.ToFullUrl(node.CreateUrl());
            }

            return(token);
        }
Example #2
0
        // TODO -- this could really use some more end to end testing
        public MenuItemToken BuildToken(MenuNode node)
        {
            var token = new MenuItemToken {
                Children      = node.Children.Select(BuildToken).ToArray(),
                Key           = node.Key.Key,
                Text          = node.Key.ToString(),
                Category      = node.Category,
                MenuItemState = _stateService.DetermineStateFor(node)
            };

            if (node.Icon().IsNotEmpty())
            {
                token.IconUrl = _urls.FindImageUrl(node.Icon());
            }

            if (node.Type == MenuNodeType.Leaf)
            {
                token.Url = _urlResolver.UrlFor(node.UrlInput, node.BehaviorChain);
            }

            node.ForData(token.Set);

            return(token);
        }