init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
27
KretaWeb/Helpers/IconExtensions.cs
Normal file
27
KretaWeb/Helpers/IconExtensions.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class IconExtensions
|
||||
{
|
||||
public static MvcHtmlString KretaIcon(this HtmlHelper helper, string icon, IDictionary<string, object> htmlAttributes = null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(string.Format("<i class=\"fa {0}\" ", icon));
|
||||
|
||||
if (htmlAttributes != null)
|
||||
{
|
||||
foreach (var item in htmlAttributes)
|
||||
{
|
||||
sb.Append(string.Format(" {0}=\"{1}\" ", item.Key, item.Value.ToString()));
|
||||
}
|
||||
}
|
||||
sb.Append("></i>");
|
||||
|
||||
MvcHtmlString str = new MvcHtmlString(sb.ToString());
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue