#1462 #865 Had to refactor how we use notificaitons. So we now have more notification fields about the request

This commit is contained in:
Jamie.Rees 2017-07-05 13:04:26 +01:00
commit b52a57b117
21 changed files with 256 additions and 112 deletions

View file

@ -6,22 +6,34 @@ namespace Ombi.Notifications.Templates
{
public class EmailBasicTemplate : IEmailBasicTemplate
{
public string TemplateLocation => Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");
public string TemplateLocation
{
get
{
#if DEBUG
return Path.Combine(Directory.GetCurrentDirectory(), "bin","Debug", "netcoreapp1.1","Templates", "BasicTemplate.html");
#else
return Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");
#endif
}
}
private const string SubjectKey = "{@SUBJECT}";
private const string BodyKey = "{@BODY}";
private const string ImgSrc = "{@IMGSRC}";
private const string DateKey = "{@DATENOW}";
public string LoadTemplate(string subject, string body, string imgSrc)
public string LoadTemplate(string subject, string body, string img)
{
try
{
var sb = new StringBuilder(File.ReadAllText(TemplateLocation));
sb.Replace(SubjectKey, subject);
sb.Replace(BodyKey, body);
sb.Replace(ImgSrc, imgSrc);
sb.Replace(DateKey, DateTime.Now.ToString("f"));
sb.Replace(ImgSrc, img);
return sb.ToString();
}

View file

@ -2,7 +2,7 @@
{
public interface IEmailBasicTemplate
{
string LoadTemplate(string subject, string body, string imgSrc);
string LoadTemplate(string subject, string body, string img);
string TemplateLocation { get; }
}
}

View file

@ -4,4 +4,10 @@
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Update="Templates\BasicTemplate.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View file

@ -172,7 +172,7 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
<tr>
<td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-top: 10px; padding-bottom: 10px; font-size: 12px; color: #999999; text-align: center;" valign="top" align="center">
Powered by <a href="https://github.com/tidusjar/Ombi" style="color: #999999; font-size: 12px; text-align: center; text-decoration: underline;">Ombi</a>
Powered by <a href="https://github.com/tidusjar/Ombi" style="color: #999999; font-size: 12px; text-align: center; text-decoration: underline;">Ombi</a> {@DATENOW}
</td>
</tr>
</table>