1

Resolved

CssOnly Helper Addition

description

Hi,

This stuff is great, but I was trying to use it with TwitterBootstrpMVC5 (BMVC) and couldnt get the icons to show when using prepend or append. Mostly because the input for the BMVC is only the CSS for the icon, it handles the wrapping of the code in the <i>. So my solution was to add another extension method for CssOnly output.

Here is the code:
public static string CssOnly(this FontAwesomeIcon helper)
{
    var css = helper.ClassAttributes.Values.Aggregate("",(o,i)=>o + " " + i).TrimStart();
    return css;
}
This allows you to use the BMVC code and font awesome fonts easily, for example:
@Html.Bootstrap().SubmitButton().Text("Log in").Style(ButtonStyle.Primary).PrependIcon(FontAwesomeIconSet.Check.CssOnly())
Maybe you could add this to the builtin extension methods.

Thanks,
Jason

comments

CodePlexAdmin wrote Jan 7, 2014 at 5:25 PM

** Closed by CodePlexAdmin 1/7/2014 10:25 AM

wrote Jan 7, 2014 at 5:25 PM

wrote Jan 7, 2014 at 7:02 PM