diff options
author | Runxi Yu <me@runxiyu.org> | 2025-09-14 22:28:12 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-09-14 22:28:12 +0800 |
commit | 01e4fd482ebcc827d3c76c00910529abbf666454 (patch) | |
tree | 300156b866864a07a0ed7680e6572ae97c20e325 /forged/templates | |
parent | Update dependencies (diff) | |
download | forge-01e4fd482ebcc827d3c76c00910529abbf666454.tar.gz forge-01e4fd482ebcc827d3c76c00910529abbf666454.tar.zst forge-01e4fd482ebcc827d3c76c00910529abbf666454.zip |
Add basic mailing listspre-refactor
Diffstat (limited to 'forged/templates')
-rw-r--r-- | forged/templates/_group_view.tmpl | 25 | ||||
-rw-r--r-- | forged/templates/group.tmpl | 42 | ||||
-rw-r--r-- | forged/templates/mailing_list.tmpl | 56 | ||||
-rw-r--r-- | forged/templates/mailing_list_message.tmpl | 42 | ||||
-rw-r--r-- | forged/templates/mailing_list_subscribers.tmpl | 82 |
5 files changed, 247 insertions, 0 deletions
diff --git a/forged/templates/_group_view.tmpl b/forged/templates/_group_view.tmpl index 92b6639..ca8062d 100644 --- a/forged/templates/_group_view.tmpl +++ b/forged/templates/_group_view.tmpl @@ -53,4 +53,29 @@ </tbody> </table> {{- end -}} +{{- if .mailing_lists -}} + <table class="wide"> + <thead> + <tr> + <th colspan="2" class="title-row">Mailing lists</th> + </tr> + <tr> + <th scope="col">Name</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + {{- range .mailing_lists -}} + <tr> + <td> + <a href="-/lists/{{- .Name | path_escape -}}/">{{- .Name -}}</a> + </td> + <td> + {{- .Description -}} + </td> + </tr> + {{- end -}} + </tbody> + </table> +{{- end -}} {{- end -}} diff --git a/forged/templates/group.tmpl b/forged/templates/group.tmpl index 3338f9b..531559a 100644 --- a/forged/templates/group.tmpl +++ b/forged/templates/group.tmpl @@ -31,6 +31,7 @@ </tr> </thead> <tbody> + <input type="hidden" name="op" value="create_repo" /> <tr> <th scope="row">Name</th> <td class="tdinput"> @@ -72,6 +73,47 @@ </table> </form> </div> + <div class="padding-wrapper"> + <form method="POST" enctype="application/x-www-form-urlencoded"> + <table> + <thead> + <tr> + <th class="title-row" colspan="2"> + Create mailing list + </th> + </tr> + </thead> + <tbody> + <input type="hidden" name="op" value="create_list" /> + <tr> + <th scope="row">Name</th> + <td class="tdinput"> + <input id="list-name-input" name="list_name" type="text" /> + </td> + </tr> + <tr> + <th scope="row">Description</th> + <td class="tdinput"> + <input id="list-desc-input" name="list_desc" type="text" /> + </td> + </tr> + </tbody> + <tfoot> + <tr> + <td class="th-like" colspan="2"> + <div class="flex-justify"> + <div class="left"> + </div> + <div class="right"> + <input class="btn-primary" type="submit" value="Create" /> + </div> + </div> + </td> + </tr> + </tfoot> + </table> + </form> + </div> {{- end -}} </main> <footer> diff --git a/forged/templates/mailing_list.tmpl b/forged/templates/mailing_list.tmpl new file mode 100644 index 0000000..9144253 --- /dev/null +++ b/forged/templates/mailing_list.tmpl @@ -0,0 +1,56 @@ +{{/* + SPDX-License-Identifier: AGPL-3.0-only + SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> +*/}} +{{- define "mailing_list" -}} +<!DOCTYPE html> +<html lang="en"> + <head> + {{- template "head_common" . -}} + <title>{{- index .group_path 0 -}}{{- range $i, $s := .group_path -}}{{- if gt $i 0 -}}/{{- $s -}}{{- end -}}{{- end }}/-/lists/{{ .list_name }} – {{ .global.forge_title -}}</title> + </head> + <body class="mailing-list"> + {{- template "header" . -}} + <main> + <div class="padding-wrapper"> + <h2>{{ .list_name }}</h2> + {{- if .list_description -}} + <p>{{ .list_description }}</p> + {{- end -}} + <p><strong>Address:</strong> <code>{{ .list_email_address }}</code></p> + {{- if .direct_access -}} + <p><a href="subscribers/">Manage subscribers</a></p> + {{- end -}} + </div> + <div class="padding-wrapper"> + <table class="wide"> + <thead> + <tr> + <th colspan="4" class="title-row">Archive</th> + </tr> + <tr> + <th scope="col">Title</th> + <th scope="col">Sender</th> + <th scope="col">Date</th> + <th scope="col">Raw</th> + </tr> + </thead> + <tbody> + {{- range .list_emails -}} + <tr> + <td><a href="message/{{ .id }}">{{ .title }}</a></td> + <td>{{ .sender }}</td> + <td>{{ .date }}</td> + <td><a href="raw/{{ .id }}">download</a></td> + </tr> + {{- end -}} + </tbody> + </table> + </div> + </main> + <footer> + {{- template "footer" . -}} + </footer> + </body> +</html> +{{- end -}} diff --git a/forged/templates/mailing_list_message.tmpl b/forged/templates/mailing_list_message.tmpl new file mode 100644 index 0000000..7bd24d6 --- /dev/null +++ b/forged/templates/mailing_list_message.tmpl @@ -0,0 +1,42 @@ +{{/* + SPDX-License-Identifier: AGPL-3.0-only +*/}} +{{- define "mailing_list_message" -}} +<!DOCTYPE html> +<html lang="en"> + <head> + {{- template "head_common" . -}} + <title>{{ .email_subject }} – {{ .global.forge_title -}}</title> + </head> + <body class="mailing-list-message"> + {{- template "header" . -}} + <main> + <div class="padding-wrapper"> + <table class="wide"> + <thead> + <tr> + <th colspan="2" class="title-row">{{ .email_subject }}</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">From</th> + <td>{{ .email_from }}</td> + </tr> + <tr> + <th scope="row">Date</th> + <td>{{ if .email_date.IsZero }}{{ .email_date_raw }}{{ else }}{{ .email_date }}{{ end }}</td> + </tr> + </tbody> + </table> + </div> + <div class="padding-wrapper"> + <div class="readme">{{ .email_body_html }}</div> + </div> + </main> + <footer> + {{- template "footer" . -}} + </footer> + </body> +</html> +{{- end -}} diff --git a/forged/templates/mailing_list_subscribers.tmpl b/forged/templates/mailing_list_subscribers.tmpl new file mode 100644 index 0000000..f0e88f5 --- /dev/null +++ b/forged/templates/mailing_list_subscribers.tmpl @@ -0,0 +1,82 @@ +{{/* + SPDX-License-Identifier: AGPL-3.0-only + SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> +*/}} +{{- define "mailing_list_subscribers" -}} +<!DOCTYPE html> +<html lang="en"> + <head> + {{- template "head_common" . -}} + <title>{{ .list_name }} subscribers – {{ .global.forge_title -}}</title> + </head> + <body class="mailing-list-subscribers"> + {{- template "header" . -}} + <main> + <div class="padding-wrapper"> + <table class="wide"> + <thead> + <tr> + <th colspan="2" class="title-row">Subscribers for {{ .list_name }}</th> + </tr> + <tr> + <th scope="col">Email</th> + <th scope="col">Actions</th> + </tr> + </thead> + <tbody> + {{- range .subscribers -}} + <tr> + <td>{{ .email }}</td> + <td> + {{- if $.direct_access -}} + <form method="POST" enctype="application/x-www-form-urlencoded"> + <input type="hidden" name="op" value="remove" /> + <input type="hidden" name="id" value="{{ .id }}" /> + <input class="btn-danger" type="submit" value="Remove" /> + </form> + {{- end -}} + </td> + </tr> + {{- end -}} + </tbody> + </table> + </div> + {{- if .direct_access -}} + <div class="padding-wrapper"> + <form method="POST" enctype="application/x-www-form-urlencoded"> + <table> + <thead> + <tr> + <th class="title-row" colspan="2">Add subscriber</th> + </tr> + </thead> + <tbody> + <input type="hidden" name="op" value="add" /> + <tr> + <th scope="row">Email</th> + <td class="tdinput"><input id="subscriber-email" name="email" type="email" /></td> + </tr> + </tbody> + <tfoot> + <tr> + <td class="th-like" colspan="2"> + <div class="flex-justify"> + <div class="left"></div> + <div class="right"> + <input class="btn-primary" type="submit" value="Add" /> + </div> + </div> + </td> + </tr> + </tfoot> + </table> + </form> + </div> + {{- end -}} + </main> + <footer> + {{- template "footer" . -}} + </footer> + </body> +</html> +{{- end -}} |