rebuilt sidebox code tighter

This commit is contained in:
2026-02-16 14:02:49 -07:00
parent 08b0fa6185
commit e1d2b60b2b
8 changed files with 243 additions and 310 deletions
+37
View File
@@ -0,0 +1,37 @@
{*
* Amsterdam Web Communities System
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*}
<!-- Communities sidebox (BOXID = 1) -->
<div class="space-y-2">
{{ if len(sb1_communities) > 0 }}
{{ range i, c := sb1_communities }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<a href="/comm/{{ c.Alias }}/profile" class="text-blue-700 hover:text-blue-900 font-bold text-sm">{{ c.Name }}</a>
{{ if sb1_isAdmin[i] }}<span class="ml-1" title="You are a host of this community">👑</span>{{ end }}
</div>
{{ end }}
{{ else }}
<div class="text-small">You are not a member of any communities.</div>
{{ end }}
</div>
{{ if sb1_canManage || sb1_canCreate }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[
{{ if sb1_canManage }}
<a href="/manage_comm" class="text-blue-700 hover:text-blue-900">Manage</a>
{{ if sb1_canCreate }}|{{ end }}
{{ end }}
{{ if sb1_canCreate }}
<a href="/create_comm" class="text-blue-700 hover:text-blue-900">Create New</a>
{{ end }}
]
</span>
</div>
{{ end }}
+32
View File
@@ -0,0 +1,32 @@
{*
* Amsterdam Web Communities System
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*}
<!-- Conferences sidebox (BOXID = 2) -->
<div class="space-y-2">
{{ if len(sb2_comm) > 0 }}
{{ range i, c := sb2_comm }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<div class="text-sm">
<a href="/comm/{{ c.Alias }}/conf/{{ sb2_alias[i] }}" class="text-blue-700 hover:text-blue-900 font-bold">{{ sb2_conf[i].Name }}</a>
<span class="text-black"> ({{ c.Name }})</span>
</div>
{{ if sb2_newFlag[i] }}<span class="ml-1" title="There are new messages in this conference">🔔</span>{{ end }}
</div>
{{ end }}
{{ else }}
<div class="text-small">No conferences in hotlist.</div>
{{ end }}
</div>
{{ if sb2_canManage }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[ <a href="/hotlist" class="text-blue-700 hover:text-blue-900">Manage</a> ]
</span>
</div>
{{ end }}
-45
View File
@@ -1,45 +0,0 @@
{*
* Amsterdam Web Communities System
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*}
<!-- Communities sidebox -->
{{ sb := .GetScratch("__sidebox") }}
<div class="mb-4">
<div class="bg-blue-600 px-2 py-1 rounded-t">
<h3 class="text-white font-bold text-base">{{ sb.Title }}</h3>
</div>
<div class="bg-blue-400 px-2 py-2 rounded-b">
<div class="space-y-2">
{{ if len(sb.Items) > 0 }}
{{ range sb.Items }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<a href="{{ .Link }}" class="text-blue-700 hover:text-blue-900 font-bold text-sm">{{ .Text }}</a>
{{ if .Flags["admin"] }}<span class="ml-1" title="You are a host of this community">👑</span>{{ end }}
</div>
{{ end }}
{{ else }}
<div class="text-small">You are not a member of any communities.</div>
{{ end }}
</div>
{{ if sb.Flags["canManage"] || sb.Flags["canCreate"] }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[
{{ if sb.Flags["canManage"] }}
<a href="/manage_comm" class="text-blue-700 hover:text-blue-900">Manage</a>
{{ if sb.Flags["canCreate"] }}|{{ end }}
{{ end }}
{{ if sb.Flags["canCreate"] }}
<a href="/create_comm" class="text-blue-700 hover:text-blue-900">Create New</a>
{{ end }}
]
</span>
</div>
{{ end }}
</div>
</div>
-40
View File
@@ -1,40 +0,0 @@
{*
* Amsterdam Web Communities System
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*}
<!-- Conference Hotlist sidebox -->
{{ sb := .GetScratch("__sidebox") }}
<div class="mb-4">
<div class="bg-blue-600 px-2 py-1 rounded-t">
<h3 class="text-white font-bold text-base">{{ sb.Title }}:</h3>
</div>
<div class="bg-blue-400 px-2 py-2 rounded-b">
<div class="space-y-2">
{{ if len(sb.Items) > 0 }}
{{ range i, item := sb.Items }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<div class="text-sm">
<a href="{{ item.Link }}" class="text-blue-700 hover:text-blue-900 font-bold">{{ item.Text }}</a>
<span class="text-black"> ({{ item.Text2 }})</span>
</div>
{{ if item.Flags["new"] }}<span class="ml-1" title="There are new messages in this conference">🔔</span>{{ end }}
</div>
{{ end }}
{{ else }}
<div class="text-small">No conferences in hotlist.</div>
{{ end }}
</div>
{{ if sb.Flags["canManage"] }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[ <a href="/hotlist" class="text-blue-700 hover:text-blue-900">Manage</a> ]
</span>
</div>
{{ end }}
</div>
</div>
+15 -30
View File
@@ -6,36 +6,21 @@
* 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/.
*}
<!-- Users Online -->
{{ sb := .GetScratch("__sidebox") }}
<div class="mb-4">
<div class="bg-blue-600 px-2 py-1 rounded-t">
<h3 class="text-white font-bold text-base">{{ sb.Title }}:</h3>
<!-- Online users sidebox (BOXID = 3) -->
<div class="space-y-1">
<div class="flex items-center">
<span class="font-bold text-sm">{{ sb3_total }} total (max {{ sb3_maxUsers }})</span>
</div>
<div class="bg-blue-400 px-2 py-2 rounded-b">
<div class="space-y-1">
{{ if len(sb.Items) > 0 }}
{{ range sb.Items }}
<div class="flex items-center">
{{ if ! .Flags["nobullet"] }}<span class="mr-2">🟣</span>{{ end }}
{{ if .LinkX() == "" }}
{{ if .Flags["bold"] }}
<span class="font-bold text-sm">{{ .Text }}</span>
{{ else }}
<span class="text-sm">{{ .Text }}</span>
{{ end }}
{{ else }}
{{ if .Flags["bold"] }}
<a href="{{ .LinkX() }}" class="text-blue-700 hover:text-blue-900 font-bold text-sm">{{ .Text }}</a>
{{ else }}
<a href="{{ .LinkX() }}" class="text-blue-700 hover:text-blue-900 text-sm">{{ .Text }}</a>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ else }}
<div class="text-small">You are not a member of any communities.</div>
{{ end }}
{{ if sb3_anons > 0 }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<span class="text-sm">Not logged in ({{ sb3_anons }})</span>
</div>
</div>
{{ end }}
{{ range _, u := sb3_users }}
<div class="flex items-center">
<span class="mr-2">🟣</span>
<a href="/user/{{ u }}" class="text-blue-700 hover:text-blue-900 font-bold text-sm">{{ u }}</a>
</div>
{{ end }}
</div>
+9 -4
View File
@@ -53,11 +53,16 @@
<!-- RIGHT SIDEBAR -->
<div class="w-80 p-4">
{{ range i, s := sideboxes }}
{{ .SetScratch("__sidebox", s) }}
{{ include s.TemplateName }}
{{ range _, s := sideboxes }}
<div class="mb-4">
<div class="bg-blue-600 px-2 py-1 rounded-t">
<h3 class="text-white font-bold text-base">{{ if .CurrentUser().IsAnon }}{{ s.TitleAnon }}{{ else }}{{ s.Title }}{{ end }}:</h3>
</div>
<div class="bg-blue-400 px-2 py-2 rounded-b">
{{ include s.TemplateName }}
</div>
</div>
{{ end }}
{{ if !.CurrentUser().IsAnon }}
<div class="text-center">
<a href="/TODO/config-sideboxes"