Exemple #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));
        }
Exemple #2
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>");
        }