init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
36
KretaWeb/Helpers/LinkExtensions.cs
Normal file
36
KretaWeb/Helpers/LinkExtensions.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.Framework;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class LinkExtensions
|
||||
{
|
||||
public static MvcHtmlString KretaLink(this HtmlHelper helper, int title, string href = "#", string classes = "", string content = "")
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"<a title=\"{StringResourcesUtil.GetString(title)}\" href=\"{href}\" class=\"{classes}\">{content}</a>");
|
||||
|
||||
MvcHtmlString str = new MvcHtmlString(sb.ToString());
|
||||
return str;
|
||||
}
|
||||
|
||||
public static MvcHtmlString KretaActionLink(this HtmlHelper helper, string title = "", string href = "#", string classes = "", string content = "", IDictionary<string, object> htmlAttributes = null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder htmlAttributesString = new StringBuilder();
|
||||
if (htmlAttributes != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> item in htmlAttributes)
|
||||
{
|
||||
htmlAttributesString.Append($"{item.Key}=\"{item.Value}\" ");
|
||||
}
|
||||
}
|
||||
sb.Append($"<a target=_blank title=\"{title}\" href=\"{href}\" class=\"{classes}\" {htmlAttributesString}>{content}</a>");
|
||||
|
||||
MvcHtmlString str = new MvcHtmlString(sb.ToString());
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue