Exemple #1
0
        public HtmlTag ContentTableTag()
        {
            var allContent = ContentFunction();

            var allContentContainer = new DivTag().AddClass("content-list-container");

            foreach (var loopContent in allContent)
            {
                if (loopContent is IContentCommon loopContentCommon)
                {
                    var photoListPhotoEntryDiv = new DivTag().AddClass("content-list-item-container");
                    photoListPhotoEntryDiv.Data("title", loopContentCommon.Title);
                    photoListPhotoEntryDiv.Data("tags",
                                                string.Join(",", Db.TagListParseToSlugs(loopContentCommon, false)));
                    photoListPhotoEntryDiv.Data("summary", loopContentCommon.Summary);
                    photoListPhotoEntryDiv.Data("contenttype", TypeToFilterTag(loopContentCommon));

                    photoListPhotoEntryDiv.Children.Add(ContentCompact.FromContentCommon(loopContentCommon));

                    allContentContainer.Children.Add(photoListPhotoEntryDiv);
                }
                else if (loopContent is LinkStream loopLinkContent)
                {
                    var photoListPhotoEntryDiv = new DivTag().AddClass("content-list-item-container");

                    var titleList = new List <string>();

                    if (!string.IsNullOrWhiteSpace(loopLinkContent.Title))
                    {
                        titleList.Add(loopLinkContent.Title);
                    }
                    if (!string.IsNullOrWhiteSpace(loopLinkContent.Site))
                    {
                        titleList.Add(loopLinkContent.Site);
                    }
                    if (!string.IsNullOrWhiteSpace(loopLinkContent.Author))
                    {
                        titleList.Add(loopLinkContent.Author);
                    }

                    photoListPhotoEntryDiv.Data("title", string.Join(" - ", titleList));
                    photoListPhotoEntryDiv.Data("tags",
                                                string.Join(",", Db.TagListParseToSlugs(loopLinkContent.Tags, false)));
                    photoListPhotoEntryDiv.Data("summary", $"{loopLinkContent.Description} {loopLinkContent.Comments}");
                    photoListPhotoEntryDiv.Data("contenttype", TypeToFilterTag(loopLinkContent));

                    photoListPhotoEntryDiv.Children.Add(ContentCompact.FromLinkStream(loopLinkContent));

                    allContentContainer.Children.Add(photoListPhotoEntryDiv);
                }
            }

            return(allContentContainer);
        }
Exemple #2
0
        public HtmlTag LinkTableTag()
        {
            var db = Db.Context().Result;

            var allContent = db.LinkStreams.OrderByDescending(x => x.CreatedOn).ToList();

            var allContentContainer = new DivTag().AddClass("content-list-container");

            foreach (var loopContent in allContent)
            {
                var photoListPhotoEntryDiv = new DivTag().AddClass("content-list-item-container");

                var titleList = new List <string>();

                if (!string.IsNullOrWhiteSpace(loopContent.Title))
                {
                    titleList.Add(loopContent.Title);
                }
                if (!string.IsNullOrWhiteSpace(loopContent.Site))
                {
                    titleList.Add(loopContent.Site);
                }
                if (!string.IsNullOrWhiteSpace(loopContent.Author))
                {
                    titleList.Add(loopContent.Author);
                }

                photoListPhotoEntryDiv.Data("title", string.Join(" - ", titleList));
                photoListPhotoEntryDiv.Data("tags", loopContent.Tags);
                photoListPhotoEntryDiv.Data("description", loopContent.Description);
                photoListPhotoEntryDiv.Data("comment", loopContent.Comments);

                photoListPhotoEntryDiv.Children.Add(ContentCompact.FromLinkStream(loopContent));

                allContentContainer.Children.Add(photoListPhotoEntryDiv);
            }

            return(allContentContainer);
        }
Exemple #3
0
        public static LiteralTag ValidationSummary(this HtmlHelper htmlHelper, bool excludePropertyErrors)
        {
            var val = ValidationExtensions.ValidationSummary(htmlHelper, excludePropertyErrors);

            if (val != null)
            {
                return(new LiteralTag(val.ToHtmlString()));
            }

            var valtag = new DivTag().AddClass(HtmlHelper.ValidationSummaryCssClassName);

            valtag.Append(new HtmlTag("ul").Append(new HtmlTag("li").Style("display", "none")));
            if (!excludePropertyErrors)
            {
                valtag.Data("valmsg-summary", "true");
            }

            return(new LiteralTag(valtag.ToHtmlString()));
        }