factoring out a lot of string constant values

This commit is contained in:
2026-05-03 22:39:11 -06:00
parent 64161721bf
commit 08a10a55dd
12 changed files with 150 additions and 103 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ func ValidateConference(next echo.HandlerFunc) echo.HandlerFunc {
return func(c *echo.Context) error {
ctxt := AmContextFromEchoContext(c)
comm := ctxt.CurrentCommunity() // set by middleware
b, err := database.AmTestService(c.Request().Context(), comm, "Conference")
b, err := database.AmTestService(c.Request().Context(), comm, database.AM_SVC_CONFERENCE)
if err != nil {
return AmSendPageData(c, ctxt, "error", err)
}
+3
View File
@@ -309,6 +309,9 @@ func setupTemplates() {
views.AddGlobal("AmsterdamVersion", config.AMSTERDAM_VERSION)
views.AddGlobal("AmsterdamCopyright", config.AMSTERDAM_COPYRIGHT)
views.AddGlobal("GlobalConfig", config.GlobalConfig)
views.AddGlobal("PLSCOPE_COMMUNITY", database.PLSCOPE_COMMUNITY)
views.AddGlobal("PLSCOPE_CONFERENCE", database.PLSCOPE_CONFERENCE)
views.AddGlobal("PLSCOPE_TOPIC", database.PLSCOPE_TOPIC)
views.AddGlobalFunc("iif", immediateIf)
views.AddGlobalFunc("postRewrite", postRewrite)
views.AddGlobalFunc("MakeIntRange", makeIntRange)
+6 -6
View File
@@ -13,11 +13,11 @@
<div class="mb-2">
<div class=" flex items-baseline gap-2">
<h1 class="text-blue-800 text-4xl font-bold">Find Posts</h1>
{{ if scope == "community" }}
{{ if scope == PLSCOPE_COMMUNITY }}
<span class="text-blue-800 text-xl font-bold ml-2">in Community: {{ entityName }}</span>
{{ else if scope == "conference" }}
{{ else if scope == PLSCOPE_CONFERENCE }}
<span class="text-blue-800 text-xl font-bold ml-2">in Conference: {{ entityName }}</span>
{{ else if scope == "topic" }}
{{ else if scope == PLSCOPE_TOPIC }}
<span class="text-blue-800 text-xl font-bold ml-2">in Topic: {{ entityName | raw }}</span>
{{ end }}
</div>
@@ -26,11 +26,11 @@
<!-- Backlink -->
<div class="mb-4">
{{ if scope == "community" }}
{{ if scope == PLSCOPE_COMMUNITY }}
<a class="text-blue-700 hover:text-blue-900 text-sm font-medium" href="{{ backlink }}">Return to Conference List</a>
{{ else if scope == "conference" }}
{{ else if scope == PLSCOPE_CONFERENCE }}
<a class="text-blue-700 hover:text-blue-900 text-sm font-medium" href="{{ backlink }}">Return to Topic List</a>
{{ else if scope == "topic" }}
{{ else if scope == PLSCOPE_TOPIC }}
<a class="text-blue-700 hover:text-blue-900 text-sm font-medium" href="{{ backlink }}">Return to Topic</a>
{{ end }}
</div>