set up front end pages for Find in Community/Conference/Topic
This commit is contained in:
@@ -21,7 +21,7 @@ _(italicized items can be deferred)_
|
|||||||
- Import User Accounts
|
- Import User Accounts
|
||||||
- Conferences list:
|
- Conferences list:
|
||||||
- Find
|
- Find
|
||||||
- Manage
|
- Manage (reorder/show/hide/delete)
|
||||||
- Create New
|
- Create New
|
||||||
- Community Admin Menu:
|
- Community Admin Menu:
|
||||||
- Set Community Category
|
- Set Community Category
|
||||||
|
|||||||
@@ -304,3 +304,47 @@ func Find(ctxt ui.AmContext) (string, any, error) {
|
|||||||
}
|
}
|
||||||
return "framed_template", "find.jet", nil
|
return "framed_template", "find.jet", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commonFindGetBackend(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
ofs := 0
|
||||||
|
p := ctxt.Parameter("ofs")
|
||||||
|
if p != "" {
|
||||||
|
v, err := strconv.Atoi(p)
|
||||||
|
if err == nil {
|
||||||
|
ofs = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctxt.VarMap().Set("ofs", ofs)
|
||||||
|
ctxt.VarMap().Set("term", "")
|
||||||
|
ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts")
|
||||||
|
return "framed_template", "find_posts.jet", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindPostsPageCommunity(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
ctxt.VarMap().Set("scope", "community")
|
||||||
|
ctxt.VarMap().Set("entityName", comm.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf", comm.Alias))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/find", comm.Alias))
|
||||||
|
return commonFindGetBackend(ctxt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindPostsPageConference(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
||||||
|
ctxt.VarMap().Set("scope", "conference")
|
||||||
|
ctxt.VarMap().Set("entityName", conf.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s", comm.Alias, ctxt.GetScratch("currentAlias")))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/find", comm.Alias, ctxt.GetScratch("currentAlias")))
|
||||||
|
return commonFindGetBackend(ctxt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindPostsPageTopic(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
|
||||||
|
ctxt.VarMap().Set("scope", "topic")
|
||||||
|
ctxt.VarMap().Set("entityName", topic.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/r/%d", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/find", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
||||||
|
return commonFindGetBackend(ctxt)
|
||||||
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ func setupEcho() *echo.Echo {
|
|||||||
commGroup.GET("/members", ui.AmWrap(MemberList))
|
commGroup.GET("/members", ui.AmWrap(MemberList))
|
||||||
commGroup.POST("/members", ui.AmWrap(MemberSearch))
|
commGroup.POST("/members", ui.AmWrap(MemberSearch))
|
||||||
commGroup.GET("/invite", ui.AmWrap(InviteToCommunity))
|
commGroup.GET("/invite", ui.AmWrap(InviteToCommunity))
|
||||||
|
commGroup.GET("/find", ui.AmWrap(FindPostsPageCommunity))
|
||||||
commGroup.GET("/admin", ui.AmWrap(CommunityAdminMenu))
|
commGroup.GET("/admin", ui.AmWrap(CommunityAdminMenu))
|
||||||
commGroup.GET("/admin/profile", ui.AmWrap(CommunityProfileForm))
|
commGroup.GET("/admin/profile", ui.AmWrap(CommunityProfileForm))
|
||||||
commGroup.POST("/admin/profile", ui.AmWrap(EditCommunityProfile))
|
commGroup.POST("/admin/profile", ui.AmWrap(EditCommunityProfile))
|
||||||
@@ -103,6 +104,7 @@ func setupEcho() *echo.Echo {
|
|||||||
confGroup.GET("", ui.AmWrap(Topics))
|
confGroup.GET("", ui.AmWrap(Topics))
|
||||||
confGroup.GET("/new_topic", ui.AmWrap(NewTopicForm))
|
confGroup.GET("/new_topic", ui.AmWrap(NewTopicForm))
|
||||||
confGroup.POST("/new_topic", ui.AmWrap(NewTopic))
|
confGroup.POST("/new_topic", ui.AmWrap(NewTopic))
|
||||||
|
confGroup.GET("/find", ui.AmWrap(FindPostsPageConference))
|
||||||
confGroup.GET("/manage", ui.AmWrap(ConfManage))
|
confGroup.GET("/manage", ui.AmWrap(ConfManage))
|
||||||
confGroup.POST("/pseud", ui.AmWrap(SetPseud))
|
confGroup.POST("/pseud", ui.AmWrap(SetPseud))
|
||||||
confGroup.GET("/fixseen", ui.AmWrap(ConfFixseen))
|
confGroup.GET("/fixseen", ui.AmWrap(ConfFixseen))
|
||||||
@@ -111,6 +113,7 @@ func setupEcho() *echo.Echo {
|
|||||||
confGroup.GET("/r/:topic", ui.AmWrap(ReadPosts), ui.SetTopic)
|
confGroup.GET("/r/:topic", ui.AmWrap(ReadPosts), ui.SetTopic)
|
||||||
confGroup.POST("/r/:topic", ui.AmWrap(PostInTopic), ui.SetTopic)
|
confGroup.POST("/r/:topic", ui.AmWrap(PostInTopic), ui.SetTopic)
|
||||||
opsGroup := confGroup.Group("/op/:topic", ui.SetTopic)
|
opsGroup := confGroup.Group("/op/:topic", ui.SetTopic)
|
||||||
|
opsGroup.GET("/find", ui.AmWrap(FindPostsPageTopic))
|
||||||
opsGroup.GET("/hide", ui.AmWrap(HideTopic))
|
opsGroup.GET("/hide", ui.AmWrap(HideTopic))
|
||||||
opsGroup.GET("/freeze", ui.AmWrap(FreezeTopic))
|
opsGroup.GET("/freeze", ui.AmWrap(FreezeTopic))
|
||||||
opsGroup.GET("/archive", ui.AmWrap(ArchiveTopic))
|
opsGroup.GET("/archive", ui.AmWrap(ArchiveTopic))
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<a href="TODO"
|
<a href="/comm/{{ commAlias }}/find"
|
||||||
class="inline-block bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded font-medium transition-colors">
|
class="inline-block bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded font-medium transition-colors">
|
||||||
Find Posts
|
Find Posts
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
{*
|
||||||
|
* 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/.
|
||||||
|
*}
|
||||||
|
<div class="p-4">
|
||||||
|
<!-- Page Title with Tabs -->
|
||||||
|
<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" }}
|
||||||
|
<span class="text-blue-800 text-xl font-bold ml-2">in Community: {{ entityName }}</span>
|
||||||
|
{{ else if scope == "conference" }}
|
||||||
|
<span class="text-blue-800 text-xl font-bold ml-2">in Conference: {{ entityName }}</span>
|
||||||
|
{{ else if scope == "topic" }}
|
||||||
|
<span class="text-blue-800 text-xl font-bold ml-2">in Topic: {{ entityName | raw }}</span>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
<hr class="border-2 border-gray-400 w-4/5 mt-2 mb-2">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Backlink -->
|
||||||
|
<div class="mb-4">
|
||||||
|
{{ if scope == "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" }}
|
||||||
|
<a class="text-blue-700 hover:text-blue-900 text-sm font-medium" href="{{ backlink }}">Return to Topic List</a>
|
||||||
|
{{ else if scope == "topic" }}
|
||||||
|
<a class="text-blue-700 hover:text-blue-900 text-sm font-medium" href="{{ backlink }}">Return to Topic</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ if isset(errorMessage) }}
|
||||||
|
<!-- Error Message Banner -->
|
||||||
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6" id="error-banner">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<span class="text-red-500 text-xl">⚠️</span>
|
||||||
|
</div>
|
||||||
|
<div class="ml-3">
|
||||||
|
<p class="text-sm font-medium" id="error-message">{{ CapitalizeString(errorMessage) }}.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Search Form -->
|
||||||
|
<div class="max-w-3xl mb-8">
|
||||||
|
<form method="POST" action="{{ postlink }}">
|
||||||
|
<input type="hidden" name="scope" value="{{ scope }}">
|
||||||
|
<input type="hidden" name="ofs" value="0">
|
||||||
|
<div class="bg-gray-50 p-6 rounded-lg">
|
||||||
|
<div class="space-y-4">
|
||||||
|
<!-- Keyword search criteria -->
|
||||||
|
<div class="flex items-center gap-2 text-sm">
|
||||||
|
<span class="text-black">Keywords:</span>
|
||||||
|
<input type="text" name="term" size="32" maxlength="255" value="{{ term }}"
|
||||||
|
placeholder="Enter search term..."
|
||||||
|
class="flex-1 min-w-64 px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||||
|
</div>
|
||||||
|
<!-- Search Button -->
|
||||||
|
<div>
|
||||||
|
<button type="submit" name="search"
|
||||||
|
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
|
||||||
|
Search
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ if isset(resultHeader) }}
|
||||||
|
<!-- Search results -->
|
||||||
|
<hr class="border-gray-400 mb-4">
|
||||||
|
<div class="flex justify-between items-center mb-4">
|
||||||
|
<div class="text-sm text-black font-bold">{{ resultHeader }}</div>
|
||||||
|
</div>
|
||||||
|
{{ if isset(resultList) }}
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<div class="bg-white border border-gray-300 rounded-lg overflow-hidden">
|
||||||
|
<table class="w-full">
|
||||||
|
<thead class="bg-gray-100 border-b-2 border-gray-300">
|
||||||
|
<tr>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">Post Link</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">Author</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider whitespace-nowrap">Post Date</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">Lines</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">Preview</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-gray-200">
|
||||||
|
{{ range _, rx := resultList }}
|
||||||
|
<tr class="hover:bg-blue-50">
|
||||||
|
<td class="px-4 py-3 text-sm">
|
||||||
|
<a href="/go/{{ rx.PostLink }}" class="text-blue-700 hover:text-blue-900 font-mono">{{ rx.PostLink }}</a>
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-sm">
|
||||||
|
<a href="/user/{{ rx.Author }}" class="text-blue-700 hover:text-blue-900">{{ rx.Author }}</a>
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-sm whitespace-nowrap text-gray-600">{{ DisplayDateTime( rx.PostDate, .) }}</td>
|
||||||
|
<td class="px-4 py-3 text-sm text-gray-600">{{ rx.Lines }}</td>
|
||||||
|
<td class="px-4 py-3 text-sm text-gray-600 italic">{{ rx.Excerpt }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ if isset(resultShowPrev) || isset(resultShowNext) }}
|
||||||
|
<!-- Bottom Navigation -->
|
||||||
|
<div class="flex justify-end mt-6">
|
||||||
|
<form method="POST" action="{{ postlink }}">
|
||||||
|
<input type="hidden" name="scope" value="{{ scope }}"/>
|
||||||
|
<input type="hidden" name="ofs" value="{{ ofs }}"/>
|
||||||
|
<input type="hidden" name="term" value="{{ term }}"/>
|
||||||
|
{{ if isset(resultShowPrev) }}
|
||||||
|
<button type="submit" name="prev"
|
||||||
|
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
|
||||||
|
⏪ Prev
|
||||||
|
</button>
|
||||||
|
{{ end }}
|
||||||
|
{{ if isset(resultShowNext) }}
|
||||||
|
<button type="submit" name="next"
|
||||||
|
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
|
||||||
|
Next ⏩
|
||||||
|
</button>
|
||||||
|
{{ end }}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
+1
-1
@@ -34,7 +34,7 @@
|
|||||||
<a href="{{ urlNextKeepNew }}"
|
<a href="{{ urlNextKeepNew }}"
|
||||||
class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Next & Keep New</a>
|
class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Next & Keep New</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a href="/TODO"
|
<a href="{{ topicListLink }}/op/{{ topicNum }}/find"
|
||||||
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Find</a>
|
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Find</a>
|
||||||
{{ if !isAnon }}
|
{{ if !isAnon }}
|
||||||
<a href="{{ topicListLink }}/op/{{ topicNum }}/manage"
|
<a href="{{ topicListLink }}/op/{{ topicNum }}/manage"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
Read New
|
Read New
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a href="/TODO/find"
|
<a href="{{ urlStem }}/find"
|
||||||
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
|
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
|
||||||
Find
|
Find
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user