mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
#1462 #865 Had to refactor how we use notificaitons. So we now have more notification fields about the request
This commit is contained in:
parent
b69b322bd5
commit
b52a57b117
21 changed files with 256 additions and 112 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -4,4 +4,10 @@
|
|||
<TargetFramework>netstandard1.4</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Templates\BasicTemplate.html">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue