fix HTML list

This commit is contained in:
Henry 2021-02-25 10:27:26 +01:00
parent 1ec3e8b064
commit a5e8165a73
4 changed files with 32 additions and 17 deletions

View File

@ -68,6 +68,10 @@ func (r DBFeedRef) Value() (driver.Value, error) {
// These also double as the i18n labels.
type PinnedNoticeName string
func (n PinnedNoticeName) String() string {
return string(n)
}
// These are the well known names that the room page will display
const (
NoticeDescription PinnedNoticeName = "NoticeDescription"
@ -77,11 +81,11 @@ const (
)
// Valid returns true if the page name is well known.
func (fpn PinnedNoticeName) Valid() bool {
return fpn == NoticeNews ||
fpn == NoticeDescription ||
fpn == NoticePrivacyPolicy ||
fpn == NoticeCodeOfConduct
func (n PinnedNoticeName) Valid() bool {
return n == NoticeNews ||
n == NoticeDescription ||
n == NoticePrivacyPolicy ||
n == NoticeCodeOfConduct
}
type PinnedNotices map[PinnedNoticeName][]Notice

View File

@ -24,7 +24,7 @@ func (h noticeHandler) list(rw http.ResponseWriter, req *http.Request) (interfac
}
return struct {
Entries admindb.SortedPinnedNotices
AllNotices admindb.SortedPinnedNotices
}{lst.Sorted()}, nil
}

View File

@ -31,6 +31,12 @@ NavAdminDashboard = "Dashboard"
NoticeEditTitle = "Edit Notice"
NoticeList = "List of notices"
NoticeAddTranslation = "Add translation"
NoticeCodeOfConduct = "Code of Conduct"
NoticeNews = "News"
NoticeDescription = "Description"
NoticePrivacyPolicy = "Privacy Policy"
[MemberCount]
description = "Number of members"

View File

@ -2,17 +2,22 @@
{{ define "content" }}
<div class="container mx-auto">
<h1 class="text-lg">{{i18n "NoticeList"}}</h1>
<ul id="theList">
{{range .Entries}}
<li>
<a href="{{urlTo "complete:notice:show" "id" .ID}}">
Title: {{.Title}}
</a>
</li>
{{range .AllNotices}}
<h3>{{i18n .Name.String }}</h3>
{{range .Notices}}
(<a
href="{{urlTo "complete:notice:show" "id" .ID}}"
>{{.Language}}</a>)
{{end}}
{{if is_logged_in}}
(<a
href="{{urlTo "admin:notice:add" "name" .Name.String}}"
>{{i18n "NoticeAddTranslation"}}</a>)
{{end}}
{{end}}
</ul>
</div>
{{end}}