Files
Disco/Disco.Web/Views/Shared/_CustomDetailValueRender.cshtml
Gary Sharp 3e57af394d feature: custom details first-class
custom details (such as those from the UserDetails plugin) can now be more deeply integrated throughtout the system
2021-02-07 18:15:52 +11:00

23 lines
626 B
Plaintext

@model System.Collections.Generic.KeyValuePair<string, string>
@using System.Text.RegularExpressions
@{
var emailMatch = Regex.Match(Model.Value, @"^(?<name>.+)\s?<(?<address>.+@.+)>$");
if (!emailMatch.Success)
{
emailMatch = Regex.Match(Model.Value, @"^(?<address>.+@.+)$");
}
}
@if (emailMatch.Success)
{
var emailAddress = emailMatch.Groups["address"].Value;
var emailName = emailAddress;
if (emailMatch.Groups["name"].Success)
{
emailName = emailMatch.Groups["name"].Value;
}
<a href="mailto:@emailAddress">@emailName</a>
}
else
{
<span>@Model.Value</span>
}