1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-27 20:58:36 +00:00

Refactor mail template and support preview (#34990)

This commit is contained in:
wxiaoguang
2025-07-09 10:25:25 +08:00
committed by GitHub
parent 2cc3368610
commit 55f350542c
14 changed files with 156 additions and 49 deletions

View File

@@ -1,2 +1,3 @@
{{template "base/head" ctx.RootData}}
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}">
{{template "base/alert" .}}

View File

@@ -0,0 +1,27 @@
{{template "devtest/devtest-header"}}
<div class="page-content devtest ui container">
<div class="flex-text-block tw-flex-wrap">
{{range $templateName := .MailTemplateNames}}
<a class="ui button" href="?tmpl={{$templateName}}">{{$templateName}}</a>
{{else}}
<p>Mailer service is not enabled or no template is found</p>
{{end}}
</div>
{{if .RenderMailTemplateName}}
<div class="tw-my-2">
<div>Preview of: {{.RenderMailTemplateName}}</div>
<div>Subject: {{.RenderMailSubject}}</div>
<iframe src="{{AppSubUrl}}/devtest/mail-preview/{{.RenderMailTemplateName}}" class="mail-preview-body"></iframe>
<style>
.mail-preview-body {
border: 1px solid #ccc;
width: 100%;
height: 400px;
overflow: auto;
}
</style>
</div>
{{end}}
</div>
{{template "devtest/devtest-footer"}}