Example #1
0
        protected override string WrapTag(TagBuilder tag)
        {
            var    value       = new AwesomeIcon(Context.Value);
            string id          = Context.Id;
            string buttonStyle = "btn-" + (Context.Style == ButtonStyle.Information ? "info" : Context.Style.ToString().ToLowerInvariant());

            var group = new TagBuilder("div");

            if (Context.Append.Count + Context.Prepend.Count > 0)
            {
                group.AddCssClass("input-group-btn");
            }
            else
            {
                group.AddCssClass("btn-group");
            }

            group.InnerHtml = "<button type='button' class='btn " + buttonStyle + " btn-iconpicker dropdown-toggle' data-toggle='dropdown'>"
                              + "<span id='" + id + "_ip' class='fa-fw " + value.ToString() + "'></span>"
                              + " <span class='caret'></span>"
                              + "</button>"
                              + GeneratePopup(id, (Context.IsRequired ? null : (Context.OptionalLabel ?? "(none)")), Context.OnClick)
                              + "<span id='" + Context.Id + "_IconName'>"
                              + GeneratePlaceholder()
                              + "</span>";

            return(tag + base.WrapTag(group));
        }
Example #2
0
 public TControl Symbol(AwesomeIcon newValue)
 {
     Context.Symbol = newValue;
     Context.Prepend.Clear();
     Context.Prepend.Add(newValue);
     return((TControl)this);
 }
Example #3
0
        public static Button BootstrapButton(this HtmlHelper htmlHelper, AwesomeIcon icon)
        {
            var control = new Button();

            control.Initialize(htmlHelper);
            control.Icon(icon);
            return(control);
        }
Example #4
0
        private static object GeneratePopupCell(AwesomeIcon icon, bool ignoreFavourites)
        {
            bool isFavourite = _favourites.Contains(icon);

            if (ignoreFavourites && isFavourite)
            {
                return("");
            }

            return("<div "
                   + (isFavourite ? "class='icon-fav'" : "")
                   + "onclick='javascript: $(\"#_ID_\").val(\"" + icon.Context.ClassName + "\");$(\"#_ID__ip\").removeClass().addClass(\"fa-fw " + icon.ToString() + "\");$(\"#_ID__IconName\").html(\"" + icon.Context.Name + "\");window.isDirty=true;_ONCLICK_'>"
                   + icon.FixedWidth(true).FixedWidth(true).ToTag()
                   + "</div>");
        }
Example #5
0
 public TControl Icon(AwesomeIcon newValue)
 {
     Context.Icon = newValue;
     return((TControl)this);
 }
 private AwesomeIcon(AwesomeIcon original)
     : this(original.Context.Id, original.Context.Name, original.Context.ClassName)
 {
     _isStatic = false;
 }
 private AwesomeIcon NonStatic(AwesomeIcon original)
 {
     return(original._isStatic ? new AwesomeIcon(original) : original);
 }