예제 #1
0
 ///<inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     CssClasses.Insert(0, "ui");
     this.AddInvertedClass(1).AddUnselectableClass(1).AddSizeClass(1).AddColorClass(1);
     CssClasses.Add("text");
 }
예제 #2
0
        //public MenuExpression<MODEL, ITEMS> For(Func<MODEL, IList<ITEMS>> expression)
        //{
        //    _nodes = expression(_model);
        //    return this;
        //}

        public override string ToString()
        {
            CssClasses.Add("entity-link-list");

            return(@"<div{0}><ul class=""sf-menu sf-vertical"">{1}</ul></div>".ToFormat(GetHtmlAttributesString(),
                                                                                        renderListItems(_items)));
        }
예제 #3
0
 public void AddCss(params string[] cssClasses)
 {
     foreach (string cssClass in cssClasses)
     {
         CssClasses.Add(cssClass);
     }
 }
 /// <inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     CssClasses.Insert(1, StackDirection.ToString().ToLower());
     CssClasses.Insert(0, "ui");
     CssClasses.Add("segments");
 }
예제 #5
0
 static CodeFormatter()
 {
     CssClasses.Add(TokenCategory.Text, new TokenCategoryClassProvider("cr-text", new KeyValuePair <TokenLanguage, string>(TokenLanguage.Html, "cr-text-html")));
     CssClasses.Add(TokenCategory.Keyword, new TokenCategoryClassProvider("cr-keyword", new KeyValuePair <TokenLanguage, string>(TokenLanguage.Html, "cr-keyword-html"), new KeyValuePair <TokenLanguage, string>(TokenLanguage.Css, "cr-keyword-css")));
     CssClasses.Add(TokenCategory.Operator, new TokenCategoryClassProvider("cr-operator"));
     CssClasses.Add(TokenCategory.PreprocessorKeyword, new TokenCategoryClassProvider("cr-preproc", new KeyValuePair <TokenLanguage, string>(TokenLanguage.Html, "cr-preproc-html")));
     CssClasses.Add(TokenCategory.String, new TokenCategoryClassProvider("cr-string", new KeyValuePair <TokenLanguage, string>(TokenLanguage.Html, "cr-string-html"), new KeyValuePair <TokenLanguage, string>(TokenLanguage.Css, "cr-string-css")));
     CssClasses.Add(TokenCategory.Number, new TokenCategoryClassProvider("cr-number"));
     CssClasses.Add(TokenCategory.Identifier, new TokenCategoryClassProvider("cr-identifier"));
     CssClasses.Add(TokenCategory.HtmlServerSideScript, new TokenCategoryClassProvider("cr-htmlserverscript"));
     CssClasses.Add(TokenCategory.HtmlString, new TokenCategoryClassProvider("cr-htmlstring"));
     CssClasses.Add(TokenCategory.Unknown, new TokenCategoryClassProvider("cr-unknown"));
     CssClasses.Add(TokenCategory.Comment, new TokenCategoryClassProvider("cr-comment"));
     CssClasses.Add(TokenCategory.XmlComment, new TokenCategoryClassProvider("cr-xmlcomment"));
     CssClasses.Add(TokenCategory.CssComment, new TokenCategoryClassProvider("cr-csscomment"));
     CssClasses.Add(TokenCategory.CssKeyword, new TokenCategoryClassProvider("cr-csskeyword"));
     CssClasses.Add(TokenCategory.CssPropertyName, new TokenCategoryClassProvider("cr-csspropertyname"));
     CssClasses.Add(TokenCategory.CssPropertyValue, new TokenCategoryClassProvider("cr-csspropertyvalue"));
     CssClasses.Add(TokenCategory.CssSelector, new TokenCategoryClassProvider("cr-cssselector"));
     CssClasses.Add(TokenCategory.CssStringValue, new TokenCategoryClassProvider("cr-cssstringvalue"));
     CssClasses.Add(TokenCategory.HtmlElementName, new TokenCategoryClassProvider("cr-htmlelementname"));
     CssClasses.Add(TokenCategory.HtmlEntity, new TokenCategoryClassProvider("cr-htmlentity"));
     CssClasses.Add(TokenCategory.HtmlOperator, new TokenCategoryClassProvider("cr-htmloperator"));
     CssClasses.Add(TokenCategory.HtmlComment, new TokenCategoryClassProvider("cr-htmlcomment"));
     CssClasses.Add(TokenCategory.HtmlAttributeName, new TokenCategoryClassProvider("cr-htmlattributename"));
     CssClasses.Add(TokenCategory.HtmlAttributeValue, new TokenCategoryClassProvider("cr-htmlattributevalue"));
     CssClasses.Add(TokenCategory.HtmlTagDelimiter, new TokenCategoryClassProvider("cr-htmltagdelimiter"));
 }
예제 #6
0
        /// <summary>
        ///   Creates an alert
        /// </summary>
        /// <param name="type">Type of alert</param>
        /// <param name="message">Alert message</param>
        /// <param name="title">Title/Heading of the alert</param>
        /// <param name="icon">Icon to be rendered with title/heading</param>
        private void CreateAlert(EMessage type, string message, string title, IHtmlComponent icon)
        {
            CssClasses.Add(type.GetStringValue());

            HtmlComponent bc = new HtmlComponent(EHtmlTag.B)
            {
                InnerHtml = title ?? string.Empty
            };

            if (icon != null)
            {
                bc.PrependTags.Add(icon);
            }

            if (WebExtrasSettings.CssFramework != ECssFramework.JQueryUI)
            {
                CssClasses.Add("alert");

                Button closeBtn = new Button(EButton.Regular, "&times;", string.Empty);
                closeBtn.CssClasses.Add("close");
                closeBtn.Attributes["data-dismiss"] = "alert";

                PrependTags.Add(closeBtn);
                PrependTags.Add(bc);
                InnerHtml = (!string.IsNullOrWhiteSpace(title) || icon != null)
          ? WebExtrasSettings.HTMLSpace + message
          : message;
            }
            else
            {
                HtmlComponent div = new HtmlComponent(EHtmlTag.Div);

                switch (type)
                {
                case EMessage.Error:
                    div.CssClasses.Add("ui-state-error");
                    break;

                case EMessage.Information:
                case EMessage.Warning:
                    div.CssClasses.Add("ui-state-highlight");
                    break;

                case EMessage.Success:
                    div.CssClasses.Add("ui-state-success");
                    break;
                }

                div.CssClasses.Add("ui-corner-all");
                div.PrependTags.Add(bc);
                div.InnerHtml = (!string.IsNullOrWhiteSpace(title) || icon != null)
          ? WebExtrasSettings.HTMLSpace + message
          : message;

                PrependTags.Add(div);
            }

            Type = type;
        }
예제 #7
0
        /// <summary>
        ///   Constructor
        /// </summary>
        /// <param name="icon">Icon to be displayed as the hypelink</param>
        /// <param name="url">Link URL</param>
        /// <param name="htmlAttributes">[Optional Extra HTML attributes</param>
        public BootstrapIconlink(EFontAwesomeIcon icon, string url, object htmlAttributes = null) :
            base(string.Empty, url, htmlAttributes)
        {
            CssClasses.Add("icon-only-link");
            m_icon = BootstrapUtil.CreateIcon(icon);

            PrependTags.Add(m_icon);
        }
예제 #8
0
        /// <summary>
        ///   Constructor
        /// </summary>
        /// <param name="icon">Icon to be displayed as the hypelink</param>
        /// <param name="url">Link URL</param>
        /// <param name="htmlAttributes">[Optional Extra HTML attributes</param>
        public BootstrapIconlink(EBootstrapIcon icon, string url, object htmlAttributes = null) :
            base(string.Empty, url, htmlAttributes)
        {
            CssClasses.Add("icon-only-link");
            IHtmlComponent iconElement = BootstrapUtil.CreateIcon(icon);

            PrependTags.Add(iconElement);
        }
예제 #9
0
        ///<inheritdoc/>
        protected internal override void ConstractClasses()
        {
            base.ConstractClasses();
            CssClasses.Insert(0, Icon.ToCssClass());
            this.AddDisabledClass(0).AddCircularClass(0).AddFittedClass(0).AddSizeClass(0).AddInvertedClass(0).AddColorClass(0);

            CssClasses.Add("icon");
        }
예제 #10
0
        /// <summary>
        ///   Converts current HTML component to a HTML encoded string
        /// </summary>
        /// <returns></returns>
        public virtual string ToHtml()
        {
            PreRender();

            if (Tag == EHtmlTag.Empty)
            {
                return(string.Empty);
            }

            if (Attributes.ContainsKey("class"))
            {
                CssClasses.Add(Attributes["class"]);
            }

            if (CssClasses.Count > 0)
            {
                Attributes["class"] = string.Join(" ", CssClasses.Distinct());
            }

            string innerHtml = string.Empty;

            if (Tag != EHtmlTag.Img)
            {
                innerHtml =
                    string.Join("", PrependTags.Select(f => f.ToHtml())) +
                    InnerHtml +
                    string.Join("", AppendTags.Select(f => f.ToHtml()));
            }

            List <string> parts = new List <string> {
                "<" + Tag.ToString().ToLowerInvariant()
            };

            string attribs = " " + string.Join(" ",
                                               Attributes.OrderBy(f => f.Key).Select(f => string.Format("{0}=\"{1}\"", f.Key, f.Value)));

            parts.Add(attribs);

            if (Tag == EHtmlTag.Img || Tag == EHtmlTag.Input)
            {
                parts.Add("/>");
            }
            else
            {
                parts.Add(">");

                if (!string.IsNullOrWhiteSpace(innerHtml))
                {
                    parts.Add(innerHtml);
                }

                parts.Add("</" + Tag.ToString().ToLowerInvariant() + ">");
            }

            string result = string.Join(string.Empty, parts);

            return(result);
        }
 /// <inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     if (IsPlaceholder)
     {
         CssClasses.Insert(1, PlaceholderClass);
     }
     CssClasses.Insert(0, "ui");
     CssClasses.Add("segment");
 }
예제 #12
0
 ///<inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     CssClasses.Insert(0, "ui");
     this.AddDisabledClass(1)
     .AddAlignmentClass(1)
     .AddContentAlignmentClass(1)
     .AddAttachClass(1)
     .AddDividingClass(1)
     .AddUnselectableClass(1)
     .AddInvertedClass(1)
     .AddColorClass(1);
     CssClasses.Add("header");
 }
예제 #13
0
 public void ToggleCss(string cssClass, bool add, params string[] removeIfAdding)
 {
     if (add)
     {
         foreach (string remove in removeIfAdding)
         {
             CssClasses.Remove(remove);
         }
         CssClasses.Add(cssClass);
     }
     else
     {
         CssClasses.Remove(cssClass);
     }
 }
        public SelectBuilder <TModel, TProperty> Select2(string placeholder = null, bool allowClear = false)
        {
            CssClasses.Add("select2");

            if (!string.IsNullOrEmpty(placeholder))
            {
                HtmlAttributes.Add("data-placeholder", placeholder);
            }

            if (allowClear)
            {
                HtmlAttributes.Add("data-allowClear", "true");
            }

            return(this);
        }
예제 #15
0
        protected override void OnStart(TextWriter writer)
        {
            // Adjust the link style if we're in a navbar
            if (GetComponent <Navbar>() != null)
            {
                CssClasses.Add(Css.NavbarLink);
            }

            // Adjust the link style if we're in an alert
            if (GetComponent <Alert>() != null)
            {
                CssClasses.Add(Css.AlertLink);
            }

            base.OnStart(writer);
        }
예제 #16
0
 internal TThis ToggleCss(string cssClass, bool add, params string[] removeIfAdding)
 {
     if (add)
     {
         foreach (string remove in removeIfAdding)
         {
             CssClasses.Remove(remove);
         }
         CssClasses.Add(cssClass);
     }
     else
     {
         CssClasses.Remove(cssClass);
     }
     return(this.GetThis());
 }
        ///<inheritdoc/>
        protected internal override void ConstractClasses()
        {
            base.ConstractClasses();
            CssClasses.Insert(0, "ui");
            if (IsPlaceholder)
            {
                CssClasses.Insert(1, PlaceholderClass);
            }


            this.AddContentSpacingClass(1).
            AddLoadingIndicatorClass(1).
            AddDisabledClass(1).
            AddContentAlignmentClass(1).
            AddCompactClass(1).
            AddAttachClass(1).
            AddCircularClass(1).
            AddISegmentStyleClass(1).
            AddInvertedClass(1).
            AddColorClass(1);
            CssClasses.Add("segment");
        }
예제 #18
0
 /// <inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     CssClasses.Insert(0, "ui");
     CssClasses.Add("header");
 }
예제 #19
0
 /// <inheritdoc/>
 protected internal override void ConstractClasses()
 {
     base.ConstractClasses();
     CssClasses.Add(Icon.ToCssClass());
     CssClasses.Add("icon");
 }
예제 #20
0
 public TBuilder CssClass(string css)
 {
     CssClasses.Add(css);
     return((TBuilder)this);
 }
예제 #21
0
 public StyledButtonExpression AddClass(string cssClass)
 {
     CssClasses.Add(cssClass);
     return(this);
 }