mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-05 22:55:58 +00:00
Improve notify mail template
This commit is contained in:
parent
af4e5f161d
commit
315ea63f44
@ -39,7 +39,8 @@ object MailContext {
|
|||||||
dueDate: Option[Timestamp],
|
dueDate: Option[Timestamp],
|
||||||
source: String,
|
source: String,
|
||||||
overDue: Boolean,
|
overDue: Boolean,
|
||||||
dueIn: Option[String]
|
dueIn: Option[String],
|
||||||
|
corrOrg: Option[String]
|
||||||
)
|
)
|
||||||
|
|
||||||
object ItemData {
|
object ItemData {
|
||||||
@ -49,9 +50,20 @@ object MailContext {
|
|||||||
val dueInLabel = dueIn.map {
|
val dueInLabel = dueIn.map {
|
||||||
case 0 => "**today**"
|
case 0 => "**today**"
|
||||||
case 1 => "**tomorrow**"
|
case 1 => "**tomorrow**"
|
||||||
case n => s"in $n days"
|
case -1 => s"**yesterday**"
|
||||||
|
case n if n > 0 => s"in $n days"
|
||||||
|
case n if n < 0 => s"${n * -1} days ago"
|
||||||
}
|
}
|
||||||
ItemData(i.id, i.name, i.date, i.dueDate, i.source, dueIn.exists(_ < 0), dueInLabel)
|
ItemData(
|
||||||
|
i.id,
|
||||||
|
i.name,
|
||||||
|
i.date,
|
||||||
|
i.dueDate,
|
||||||
|
i.source,
|
||||||
|
dueIn.exists(_ < 0),
|
||||||
|
dueInLabel,
|
||||||
|
i.corrOrg.map(_.name)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
implicit def yamusca: ValueConverter[ItemData] =
|
implicit def yamusca: ValueConverter[ItemData] =
|
||||||
|
@ -5,22 +5,22 @@ import yamusca.implicits._
|
|||||||
object MailTemplate {
|
object MailTemplate {
|
||||||
|
|
||||||
val text = mustache"""
|
val text = mustache"""
|
||||||
## Hello {{{ username }}},
|
Hello {{{ username }}},
|
||||||
|
|
||||||
this is Docspell informing you about your next due items coming up.
|
this is Docspell informing you about your next due items coming up.
|
||||||
|
|
||||||
{{#itemUri}}
|
{{#itemUri}}
|
||||||
{{#items}}
|
{{#items}}
|
||||||
- {{#overDue}}**(OVERDUE)** {{/overDue}}[{{name}}]({{itemUri}}/{{id}}),
|
- {{#overDue}}**(OVERDUE)** {{/overDue}}[{{name}}]({{itemUri}}/{{id}}),
|
||||||
due {{dueIn}} on *{{dueDate}}*
|
{{#overDue}}was {{/overDue}}due {{dueIn}} on *{{dueDate}}*; {{#corrOrg}}from {{corrOrg}}{{/corrOrg}}
|
||||||
(received on {{date}} via {{source}})
|
received on {{date}} via {{source}}
|
||||||
{{/items}}
|
{{/items}}
|
||||||
{{/itemUri}}
|
{{/itemUri}}
|
||||||
{{^itemUri}}
|
{{^itemUri}}
|
||||||
{{#items}}
|
{{#items}}
|
||||||
- {{#overDue}}**(OVERDUE)** {{/overDue}}*{{name}}*,
|
- {{#overDue}}**(OVERDUE)** {{/overDue}}*{{name}}*,
|
||||||
due {{dueIn}} on *{{dueDate}}*
|
{{#overDue}}was {{/overDue}}due {{dueIn}} on *{{dueDate}}*; {{#corrOrg}}from {{corrOrg}}{{/corrOrg}}
|
||||||
(received on {{date}} via {{source}})
|
received on {{date}} via {{source}}
|
||||||
{{/items}}
|
{{/items}}
|
||||||
{{/itemUri}}
|
{{/itemUri}}
|
||||||
{{#more}}
|
{{#more}}
|
||||||
@ -29,6 +29,7 @@ this is Docspell informing you about your next due items coming up.
|
|||||||
|
|
||||||
|
|
||||||
Sincerely yours,
|
Sincerely yours,
|
||||||
|
|
||||||
Docspell
|
Docspell
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -100,7 +100,9 @@ object NotifyDueItemsTask {
|
|||||||
From(cfg.mailFrom),
|
From(cfg.mailFrom),
|
||||||
Tos(recp),
|
Tos(recp),
|
||||||
Subject("Next due items"),
|
Subject("Next due items"),
|
||||||
MarkdownBody[F](md)
|
MarkdownBody[F](md).withConfig(
|
||||||
|
MarkdownConfig("body { font-size: 10pt; font-family: sans-serif; }")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user