Exemplo n.º 1
0
        /// <summary>
        ///     Creates one breadcrumb link entry with the specified
        ///     <paramref name="title" /> and link.
        /// </summary>
        /// <param name="title">The title of the breadcrumb link</param>
        /// <param name="stringUrl">The fully quallified URL</param>
        /// <param name="divider">
        ///     Specify the divider created after the link. Set to "null" or empty
        ///     for no divider.
        /// </param>
        public MvcHtmlString BreadcrumbLink(string title, string stringUrl, string divider)
        {
            var listItem = new TagBuilderExt("li");

            if (IsCurrentUrl(stringUrl))
            {
                listItem.AddCssClass("active");
                listItem.SetInnerText(title);
            }
            else
            {
                var link = new TagBuilderExt("a");
                link.MergeAttribute("href", stringUrl);
                link.SetInnerText(title);
                listItem.AddChildTag(link);
            }

            if (!string.IsNullOrEmpty(divider))
            {
                var dividerTag = new TagBuilderExt("span", divider);
                dividerTag.AddCssClass("divider");
                listItem.AddChildTag(dividerTag);
            }
            return(listItem.ToMvcHtmlString());
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates an emphasized paragraph
        /// </summary>
        /// <param name="text">Content of the emphasized paragraph</param>
        /// <param name="emphasisType">Type of the emphasis</param>
        public MvcHtmlString EmphasizedParagraph(string text, EmphasisType emphasisType)
        {
            var p = new TagBuilderExt("p");

            switch (emphasisType)
            {
            case EmphasisType.Muted:
                p.AddCssClass("muted");
                break;

            case EmphasisType.Warning:
                p.AddCssClass("text-warning");
                break;

            case EmphasisType.Error:
                p.AddCssClass("text-error");
                break;

            case EmphasisType.Info:
                p.AddCssClass("text-info");
                break;

            case EmphasisType.Success:
                p.AddCssClass("text-success");
                break;

            default:
                throw new ArgumentOutOfRangeException("emphasisType");
            }

            p.SetInnerText(text);
            return(p.ToMvcHtmlString());
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Makes a paragraph using the lead class to make it stand out.
        /// </summary>
        /// <param name="text">Content of the paragraph</param>
        public MvcHtmlString LeadBody(string text)
        {
            var p = new TagBuilderExt("p");

            p.AddCssClass("lead");
            p.SetInnerText(text);

            return(p.ToMvcHtmlString());
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Creates one menu link entry with the specified
        ///     <paramref name="title" /> and link.
        /// </summary>
        /// <param name="title">The title of the menu link</param>
        /// <param name="url">The fully quallified URL</param>
        public MvcHtmlString MenuLink(string title, string url)
        {
            var listItem = new TagBuilderExt("li");

            if (IsCurrentUrl(url))
            {
                listItem.AddCssClass("active");
            }
            var link = new TagBuilderExt("a");

            link.MergeAttribute("href", url);
            link.SetInnerText(title);
            listItem.AddChildTag(link);

            return(listItem.ToMvcHtmlString());
        }