Beispiel #1
0
        protected override void RenderProcess(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";
            output.TagMode = TagMode.StartTagAndEndTag;
            output.AddCssClass("progress");

            // Height
            output.AddCssStyle("height", $"{this.Height}px");

            output.Content.SetHtmlContent(this.BuildProgressbar());
        }
Beispiel #2
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("img");
            output.AddCssClass("media-object");

            output.TagMode = TagMode.SelfClosing;

            if (Href.IsNotNullOrEmpty())
            {
                TagBuilder link = new TagBuilder("a")
                {
                    TagRenderMode = TagRenderMode.Normal
                };
                link.MergeAttribute("href", Href);

                output.WrapOutside(link);
            }

            if (Height.IsNotNullOrEmpty())
            {
                output.AddCssStyle("height", Height);
            }

            if (Width.IsNotNullOrEmpty())
            {
                output.AddCssStyle("width", Width);
            }

            TagBuilder wrapper = new TagBuilder("div")
            {
                TagRenderMode = TagRenderMode.Normal
            };

            wrapper.AddCssClass(Align.GetEnumInfo().Name);

            output.WrapOutside(wrapper);
        }
 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output)
 {
     if (ProgressContext != null)
     {
         if (!context.AllAttributes.ContainsName(AnimatedAttributeName))
         {
             Animated = ProgressContext.Animated;
         }
         if (!context.AllAttributes.ContainsName(StripedAttributeName))
         {
             Striped = ProgressContext.Striped;
         }
         if (!context.AllAttributes.ContainsName(DisplayValueAttributeName))
         {
             DisplayValue = ProgressContext.DisplayValue;
         }
         if (!context.AllAttributes.ContainsName(SrTextAttributeName))
         {
             SrText = ProgressContext.SrText;
         }
     }
     else
     {
         output.PreElement.SetHtmlContent("<div class=\"progress\">");
         output.PostElement.SetHtmlContent("</div>");
     }
     output.TagName = "div";
     output.TagMode = TagMode.StartTagAndEndTag;
     output.Attributes.RemoveAll(DisplayValueAttributeName, SrTextAttributeName, AnimatedAttributeName,
                                 StripedAttributeName);
     output.AddCssClass("progress-bar");
     output.Attributes.AddAriaAttribute("valuemin", 0);
     output.Attributes.AddAriaAttribute("valuemax", 100);
     output.Attributes.AddAriaAttribute("valuenow", Value);
     output.Attributes.Add("role", "progressbar");
     output.AddCssStyle("width", Value + "%");
     if (SrText == null)
     {
         SrText = Ressources.PorgressBarCompleteSrHint;
     }
     if (DisplayValue ?? false)
     {
         output.Content.AppendHtml(string.IsNullOrWhiteSpace(SrText)
                                       ? Value.ToString()
                                       : Value + @" %<span class=""sr-only""> " + SrText + "</span>");
         output.AddCssStyle("min-width", "2em");
     }
     else
     {
         output.Content.AppendHtml(@"<span class=""sr-only"">" + Value + @" % " + SrText + "</span>");
     }
     if (Animated ?? false)
     {
         output.AddCssClass("active");
         output.AddCssClass("progress-bar-striped");
     }
     if (Striped ?? false)
     {
         output.AddCssClass("progress-bar-striped");
     }
     if (Context.HasValue)
     {
         output.AddCssClass("progress-bar-" + Context.Value.ToString().ToLower());
     }
 }
Beispiel #4
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("div");
            output.AddCssClass("progress-bar");

            output.TagMode = TagMode.StartTagAndEndTag;

            // Value
            if (Value > 100)
            {
                Value = 100;
            }

            output.MergeAttribute("aria-valuemin", "0");
            output.MergeAttribute("aria-valuemax", "100");
            output.MergeAttribute("aria-valuenow", Value.ToString());
            output.MergeAttribute("role", "progressbar");

            if (IsVertical)
            {
                output.AddCssStyle("height", Value.ToString() + "%");
            }
            else
            {
                output.AddCssStyle("width", Value.ToString() + "%");
            }


            // Color
            if (Color != ProgressBarTagColor.Default)
            {
                output.AddCssClass(this.Color.GetEnumInfo().Name);
            }

            // Label
            if (this.IsLabeled)
            {
                output.AddCssStyle("min-width", "3em");
                output.PreContent.Append(Value.ToString() + "%");
            }

            // Animated and Striped
            if (this.IsAnimated)
            {
                output.AddCssClass("progress-bar-striped");
                output.AddCssClass("active");
            }
            else if (this.IsStriped)
            {
                output.AddCssClass("progress-bar-striped");
            }

            if (ProgressStackContext == null)
            {
                TagBuilder wrapper = new TagBuilder("div")
                {
                    TagRenderMode = TagRenderMode.Normal
                };
                wrapper.AddCssClass("progress");

                if (IsVertical)
                {
                    if (Height == 0)
                    {
                        Height = 200;
                    }
                    if (Width == 0)
                    {
                        Width = 30;
                    }

                    //wrapper.AddCssClass("vertical");

                    wrapper.AddCssStyle("position", "relative");
                    wrapper.AddCssStyle("display", "inline-block");
                    wrapper.AddCssStyle("height", Height + "px");
                    wrapper.AddCssStyle("width", Width + "px");

                    output.AddCssStyle("width", "100%");
                    output.AddCssStyle("position", "absolute");
                    output.AddCssStyle("bottom", "0");
                }
                else
                {
                    if (this.Height > 0)
                    {
                        wrapper.AddCssStyle("height", Height + "px");
                    }
                }

                output.WrapOutside(wrapper);
            }
        }