public static MvcHtmlString ActionButtonConstructor(ButtonParameters buttonParameters, string htmlStr)
        {
            htmlStr = HTMLHelper.AddClassToHtmlElement(htmlStr, string.Format("btn {0} {1} {2}", _htmlButtonRole[buttonParameters.ButtonRole]
                                                                              , _htmlButtonHeight[buttonParameters.ButtonHeight]
                                                                              , (!buttonParameters.Enabled?" .disabled":"")));
            if (!string.IsNullOrEmpty(buttonParameters.ToolTip))
            {
                htmlStr = HTMLHelper.AddAttributesToHtmlElement(htmlStr, "rel='tooltip'");
                htmlStr = HTMLHelper.AddAttributesToHtmlElement(htmlStr, string.Format("title='{0}'", buttonParameters.Text));
            }

            htmlStr = (!buttonParameters.Enabled) ? HTMLHelper.AddAttributesToHtmlElement(htmlStr, "disabled='disabled'") : htmlStr;
            htmlStr = (buttonParameters.ButtonId != null) ? HTMLHelper.AddAttributesToHtmlElement(htmlStr, "id='" + buttonParameters.ButtonId + "'") : htmlStr;
            var innerHtml = string.Format("{0}{1}", IconConstructor.ConstructIcon(new IconParameters(buttonParameters.ButtonIcon, buttonParameters.ButtonIconColor))
                                          , buttonParameters.Type == ButtonType.ImageText ? " " + buttonParameters.Text:"");

            htmlStr = (buttonParameters.Width != null) ? HTMLHelper.AddStyleAttributeToHtmlElement(htmlStr, string.Format("width:{0};text-align:left", buttonParameters.Width)) : htmlStr;
            htmlStr = htmlStr.Replace("REPLACE", innerHtml);
            return(new MvcHtmlString(htmlStr));
        }
Beispiel #2
0
 public static MvcHtmlString Badge(this HtmlHelper helper, BadgeType badgeType, IconParameters icon, string text)
 {
     return(BadgeConstructor.ConstructBadge(badgeType, IconConstructor.ConstructIcon(icon) + " " + text));
 }