got display of advanced post control buttons to work, fixed topic name display and display of "new" messages with 0 new

This commit is contained in:
2026-01-14 23:00:40 -07:00
parent 01345e0d38
commit dd7b3d7858
4 changed files with 33 additions and 12 deletions
+4 -1
View File
@@ -489,7 +489,9 @@ func ReadPosts(ctxt ui.AmContext) (string, any, error) {
postRange[0] = lastRead + 1
postRange[1] = topic.TopMessage
count := postRange[1] - postRange[0] + 1
if count > ctxt.Globals().PostsPerPage {
if count == 0 {
postRange[0] = max(postRange[1]-ctxt.Globals().PostsPerPage+1, 0)
} else if count > ctxt.Globals().PostsPerPage {
postRange[0] = postRange[1] - ctxt.Globals().PostsPerPage + 1
} else if count < ctxt.Globals().PostsPerPage {
pin = postRange[0] - 1
@@ -525,6 +527,7 @@ func ReadPosts(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("pseud", pseud)
// Render the output.
ctxt.VarMap().Set("advancedControls", ctxt.HasParameter("ac") && len(posts) == 1)
ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("%s: %s", topic.Name, summaryLine))
ctxt.VarMap().Set("topicName", topic.Name)
ctxt.VarMap().Set("summaryLine", summaryLine)
+1 -1
View File
@@ -11,7 +11,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ amsterdam_pageTitle }} - {{ GlobalConfig.Site.Title }}</title>
<title>{{ amsterdam_pageTitle | raw }} - {{ GlobalConfig.Site.Title }}</title>
<link rel="icon" href="/img/builtin/AmsterdamIcon32.png" type="image/png" />
<link rel="shortcut icon" href="/img/builtin/AmsterdamIcon32.ico" />
{{ if isset(amsterdam_genRefresh) && GlobalConfig.Site.TopRefresh > 0 }}
+27 -9
View File
@@ -9,7 +9,7 @@
<div class="p-4">
<!-- Page Title -->
<div class="mb-6">
<h1 class="text-blue-800 text-4xl font-bold inline">{{ topicName }}</h1>
<h1 class="text-blue-800 text-4xl font-bold inline">{{ topicName | raw }}</h1>
<span class="text-blue-800 text-xl font-bold ml-2">{{ summaryLine }}</span>
<hr class="border-2 border-gray-400 w-4/5 mt-2 mb-6">
</div>
@@ -74,13 +74,31 @@
<!-- Messages -->
<div class="space-y-6 mb-8">
{{ m := map("foo", "bar") }}
{{ range i, p := posts }}
{{ m = map("post_cur", p, "post_userName", post_getUserName(p, .), "post_text", post_getText(p, .),
"post_overrideLine", post_getOverrideLine(p, .), "post_overrideLink", post_getOverrideLink(p, post_topicPermalink)) }}
{{ .SubRender2("singlepost.jet", m) | raw }}
{{ if pin == p.Num }}<hr/>{{ end }}
{{ end }}
{{ if advancedControls }}<div class="flex gap-4">{{ end }}
{{ m := map("foo", "bar") }}
{{ range i, p := posts }}
{{ m = map("post_cur", p, "post_userName", post_getUserName(p, .), "post_text", post_getText(p, .),
"post_overrideLine", post_getOverrideLine(p, .), "post_overrideLink", post_getOverrideLink(p, post_topicPermalink)) }}
{{ .SubRender2("singlepost.jet", m) | raw }}
{{ if advancedControls }}
<div class="flex flex-col gap-2">
<button class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">
Hide
</button>
<button class="bg-yellow-600 hover:bg-yellow-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">
Scribble
</button>
<button class="bg-red-600 hover:bg-red-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">
Nuke
</button>
<button class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">
Publish
</button>
</div>
{{ end }}
{{ if pin == p.Num }}<hr/>{{ end }}
{{ end }}
{{ if advancedControls }}</div>{{ end }}
</div>
<!-- Bottom Navigation -->
@@ -104,7 +122,7 @@
<!-- Reply Form -->
<hr class="border-gray-400 mb-6">
<h2 class="text-2xl font-bold text-black mb-4">Post Message in "{{ topicName }}":</h2>
<h2 class="text-2xl font-bold text-black mb-4">Post Message in "{{ topicName | raw }}":</h2>
<form method="POST" action="{{ post_stem }}">
<input type="hidden" name="xp" value="{{ post_max }}"/>
+1 -1
View File
@@ -6,7 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*}
<div class="border-2 border-gray-300 rounded-lg p-4 bg-white">
<div class="flex-1 border-2 border-gray-300 rounded-lg p-4 bg-white">
<div class="flex justify-between items-start mb-3">
<div class="text-sm text-gray-600">
<a href="{{ post_stem }}?r={{ post_cur.Num }}&ac=1" class="text-blue-700 hover:text-blue-900 font-mono">{{ post_cur.Num }}</a> of