Edit/delete bookmarks feature

This commit is contained in:
2022-05-30 13:28:46 +09:30
parent 226fa4a143
commit 173474d23f
8 changed files with 117 additions and 4 deletions

View File

@@ -53,6 +53,8 @@
{{ template "manage.html" . }}
{{ else if eq .page "config" }}
{{ template "config.html" . }}
{{ else if eq .page "edit" }}
{{ template "edit.html" . }}
{{ end }}
{{/* template "foundation_sample.html" . */}}
</div>

7
web/templates/edit.html Normal file
View File

@@ -0,0 +1,7 @@
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<h5>Edit</h5>
{{ template "edit_form.html" . }}
</div>
</div>

View File

@@ -0,0 +1,32 @@
<form onsubmit="return false;" id="edit-form" hx-target="#edit-form">
<table>
<tr>
<th>Title</th>
<td>{{ .bookmark.Info.Title }}</td>
</tr>
<tr>
<th>URL</th>
<td>{{ .bookmark.URL }}</td>
</tr>
<tr>
<th>tags</th>
<td>
{{ template "tags_widget.html" .tw }}
</td>
</tr>
<tr>
<th>Created</th>
<td>{{ (nicetime .bookmark.TimestampCreated).HumanDuration }}</td>
</tr>
<tr>
<th>Last Scraped</th>
<td>{{ (nicetime .bookmark.TimestampLastScraped).HumanDuration }}</td>
</tr>
</table>
<p>
<button type="button" hx-confirm="Delete this bookmark permanently?" hx-delete="/edit/{{.bookmark.ID}}" class="alert button">delete</button>
<button type="button" class="button" hx-post="/edit/{{.bookmark.ID}}">save</button>
</p>
</form>

View File

@@ -0,0 +1,2 @@
<p>Bookmark deleted</p>

View File

@@ -5,7 +5,7 @@
<table>
<tr>
<th>id</th>
<th>&nbsp;</th>
<th>title/url</th>
<th>tags</th>
<th class="show-for-large">created</th>
@@ -13,7 +13,7 @@
</tr>
{{ range .bookmarks }}
<tr>
<th>{{ .ID }}</th>
<th><a class="button" href="/edit/{{ .ID }}">edit</a></th>
<td>
<a href="{{ .URL }}">{{ .Info.Title }}</a>
<br>

View File

@@ -5,7 +5,7 @@
hx-target="#label-widget"
hx-trigger="change">
<label for="tag-entry"
class="Xtext-right Xmiddle">Tags</label>
class="">Tags</label>
<input id="tag-entry" type="text" name="tag" placeholder="enter tags" />
</div>