Add basic sorting to management interface
This commit is contained in:
@@ -13,8 +13,9 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ template "tags_widget.html" . }}
|
||||
{{ template "manage_results.html" . }}
|
||||
|
||||
</form>
|
||||
{{ template "manage_results.html" . }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,10 +2,10 @@
|
||||
<table id="manage-results">
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>title/url</th>
|
||||
<th hx-post="/manage/results?sort=title" hx-target="#manage-results">title/url</th>
|
||||
<th>tags</th>
|
||||
<th class="show-for-large">created</th>
|
||||
<th class="show-for-large">scraped</th>
|
||||
<th hx-post="/manage/results?sort=created" hx-target="#manage-results" class="show-for-large">created</th>
|
||||
<th hx-post="/manage/results?sort=scraped" hx-target="#manage-results" class="show-for-large">scraped</th>
|
||||
</tr>
|
||||
{{ range .bookmarks }}
|
||||
<tr>
|
||||
|
||||
@@ -92,14 +92,14 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
||||
r.POST("/manage/results", func(c *gin.Context) {
|
||||
query := c.PostForm("query")
|
||||
tags := []string{}
|
||||
sort := c.Query("sort")
|
||||
|
||||
if c.PostForm("tags_hidden") != "" {
|
||||
tags = strings.Split(c.PostForm("tags_hidden"), "|")
|
||||
}
|
||||
allBookmarks, _ := bmm.Search(db.SearchOptions{Query: query, Tags: tags})
|
||||
allBookmarks, _ := bmm.Search(db.SearchOptions{Query: query, Tags: tags, Sort: sort})
|
||||
meta := gin.H{"config": config, "bookmarks": allBookmarks}
|
||||
|
||||
log.Printf("query is %s, tags %v", query, tags)
|
||||
|
||||
c.HTML(http.StatusOK,
|
||||
"manage_results.html", meta,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user