Manage list can be free-text searched and limited by tag.

This commit is contained in:
2022-06-06 22:05:56 +09:30
parent 65100459d6
commit 1563c7b21d
9 changed files with 94 additions and 46 deletions

View File

@@ -1,38 +1,20 @@
<div class="grid-x grid-padding-x">
<div class="grid-x grid-padding-x" id="manage">
<div class="large-12 cell">
<h5>Manage links</h5>
<table>
<tr>
<th>&nbsp;</th>
<th>title/url</th>
<th>tags</th>
<th class="show-for-large">created</th>
<th class="show-for-large">scraped</th>
</tr>
{{ range .bookmarks }}
<tr>
<th><a class="button" href="/edit/{{ .ID }}">edit</a></th>
<td>
<a href="{{ .URL }}">{{ .Info.Title }}</a>
<br>
<a href="{{ .URL }}">{{ niceURL .URL }}</a>
</td>
<td>
{{ range .Tags }}
<span class="label primary">{{ . }}</span>
{{ end }}
</td>
<td class="show-for-large">{{ (nicetime .TimestampCreated).HumanDuration }} ago</td>
<td class="show-for-large">{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td>
<td>
<a class="button" hx-swap="outerHTML" hx-post="/scrape/{{ .ID }}">scrape</button>
</td>
</tr>
{{ end }}
</table>
<form onsubmit="return false">
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Filter</label>
<input type="text" name="query" placeholder="" hx-post="/manage/results" hx-swap="outerHTML"
hx-trigger="keyup changed delay:500ms, tag_update" hx-target="#manage-results"
hx-indicator="#htmx-indicator-search" id="manage-search" />
</div>
</div>
{{ template "tags_widget.html" . }}
</form>
{{ template "manage_results.html" . }}
</div>
</div>

View File

@@ -0,0 +1,31 @@
<table id="manage-results">
<tr>
<th>&nbsp;</th>
<th>title/url</th>
<th>tags</th>
<th class="show-for-large">created</th>
<th class="show-for-large">scraped</th>
</tr>
{{ range .bookmarks }}
<tr>
<th><a class="button" href="/edit/{{ .ID }}">edit</a></th>
<td>
<a href="{{ .URL }}">{{ .Info.Title }}</a>
<br>
<a href="{{ .URL }}">{{ niceURL .URL }}</a>
</td>
<td>
{{ range .Tags }}
<span class="label primary">{{ . }}</span>
{{ end }}
</td>
<td class="show-for-large">{{ (nicetime .TimestampCreated).HumanDuration }} ago</td>
<td class="show-for-large">{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td>
<td>
<a class="button" hx-swap="outerHTML" hx-post="/scrape/{{ .ID }}">scrape</button>
</td>
</tr>
{{ end }}
</table>

View File

@@ -1,4 +1,4 @@
<div id="label-widget">
<div id="label-widget" >
<div class="grid-x grid-padding-x">
<div class="small-9 medium-10 large-5 cell"
hx-post="/tags"
@@ -9,7 +9,7 @@
<input id="tag-entry" type="text" name="tag" placeholder="enter tags" />
</div>
<div class="small-12 large-6 cell">
<div class="small-12 large-6 cell" id="tags-list">
{{ range .tags }}
<a href="#"
class=""
@@ -20,7 +20,7 @@
<span class="label primary">{{ . }}</span>
{{ end }}
<input type="hidden" name="tags_hidden" value="{{ .tags_hidden }}">
<input _="on load send tag_update to #manage-search" type="hidden" id="tags-hidden" name="tags_hidden" value="{{ .tags_hidden }}">
</div>
</div>
</div>