Esempio n. 1
0
        public IEnumerable <HtmlTag> Build(AssetTagPlan plan)
        {
            // This will happen when a user tries to request an asset set
            // with no assets -- think optional sets
            if (!plan.Subjects.Any())
            {
                return(new HtmlTag[0]);
            }

            var missingSubjects = plan.RemoveMissingAssets();
            var func            = _builders[plan.MimeType];
            Func <IAssetTagSubject, HtmlTag> builder = s =>
            {
                var url = _urls.UrlForAsset(s.Folder, s.Name);
                return(func(s, url));
            };

            var missingTags = _missingHandler.BuildTagsAndRecord(missingSubjects);
            var assetTags   = plan.Subjects.Select(builder);

            return(missingTags.Union(assetTags));
        }
Esempio n. 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(),

                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);
        }
Esempio n. 3
0
 public string ImageUrlFor(ImageUrlRequest image)
 {
     return(_urls.UrlForAsset(AssetFolder.images, image.Name));
 }
Esempio n. 4
0
        public HttpResponse GetAsset(AssetFolder?folder, string name, string etag = null)
        {
            var url = _urls.UrlForAsset(folder, name);

            return(Get(url, etag: etag));
        }