fixed concurrency in users & communities, implemented Communities sidebox
This commit is contained in:
+8
-1
@@ -28,11 +28,11 @@ type AmContext interface {
|
||||
RC() int
|
||||
OutputType() string
|
||||
Render(string) error
|
||||
Scratchpad() map[string]any
|
||||
SubRender(string) ([]byte, error)
|
||||
Session() *sessions.Session
|
||||
SetOutputType(string)
|
||||
SetRC(int)
|
||||
GetScratch(string) any
|
||||
SetScratch(string, any)
|
||||
URLPath() string
|
||||
VarMap() jet.VarMap
|
||||
@@ -117,6 +117,13 @@ func (c *amContext) SetRC(rc int) {
|
||||
c.httprc = rc
|
||||
}
|
||||
|
||||
func (c *amContext) GetScratch(name string) any {
|
||||
if c.scratchpad == nil {
|
||||
return nil
|
||||
}
|
||||
return c.scratchpad[name]
|
||||
}
|
||||
|
||||
func (c *amContext) SetScratch(name string, val any) {
|
||||
if c.scratchpad == nil {
|
||||
c.scratchpad = make(map[string]any)
|
||||
|
||||
+13
-9
@@ -6,20 +6,24 @@
|
||||
* 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/.
|
||||
*}
|
||||
<!-- Featured Communities -->
|
||||
<!-- Communities sidebox -->
|
||||
{{ sb := .GetScratch("__sidebox") }}
|
||||
<div class="mb-4">
|
||||
<div class="bg-blue-600 px-2 py-1 rounded-t">
|
||||
{{ if .CurrentUser().IsAnon }}
|
||||
<h3 class="text-white font-bold text-base">Featured Communities:</h3>
|
||||
{{ else }}
|
||||
<h3 class="text-white font-bold text-base">Your Communities:</h3>
|
||||
{{ end }}
|
||||
<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="flex items-center">
|
||||
<span class="mr-2">🟣</span>
|
||||
<a href="http://necrovenice:8080/venice/community/Piazza"
|
||||
class="text-blue-700 hover:text-blue-900 font-bold text-sm">La Piazza</a>
|
||||
{{ if len(sb.Items) > 0 }}
|
||||
{{ range sb.Items }}
|
||||
<div class="text-small">
|
||||
<span class="mr-2">🟣</span>
|
||||
<a href="{{ .Link }}" class="text-blue-700 hover:text-blue-900 font-bold text-sm">{{ .Text }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<div class="text-small">You are not a member of any communities.</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user