feat: bookmark folder reordering and add-existing-link

Add up/down arrow buttons to reorder links within a folder, with lazy
sort_order initialization. Add dropdown to move existing links into the
current folder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 21:08:20 +00:00
parent 0ed86ee2dc
commit c8a1d5ba40
2 changed files with 133 additions and 2 deletions

View File

@@ -38,6 +38,23 @@
<button type="submit" class="btn btn-ghost btn-xs" style="color: var(--red)">Delete Folder</button>
</form>
</div>
{% if available_links %}
<div class="card" style="margin-bottom: 12px;">
<form action="/weblinks/folders/{{ current_folder.id }}/add-link" method="post"
style="display: flex; gap: 8px; align-items: end; padding: 12px;">
<div class="form-group" style="flex: 1; margin: 0;">
<label class="form-label">Add existing link</label>
<select name="link_id" class="form-select" required>
<option value="">Select link...</option>
{% for l in available_links %}
<option value="{{ l.id }}">{{ l.label }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary btn-sm">Add</button>
</form>
</div>
{% endif %}
{% endif %}
{% if items %}
@@ -56,6 +73,18 @@
{% endfor %}
{% endif %}
<div class="row-actions">
{% if current_folder_id %}
<form action="/weblinks/folders/{{ current_folder_id }}/reorder" method="post" style="display:inline">
<input type="hidden" name="link_id" value="{{ item.id }}">
<input type="hidden" name="direction" value="up">
<button type="submit" class="btn btn-ghost btn-xs" title="Move up">&#9650;</button>
</form>
<form action="/weblinks/folders/{{ current_folder_id }}/reorder" method="post" style="display:inline">
<input type="hidden" name="link_id" value="{{ item.id }}">
<input type="hidden" name="direction" value="down">
<button type="submit" class="btn btn-ghost btn-xs" title="Move down">&#9660;</button>
</form>
{% endif %}
<a href="/weblinks/{{ item.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<form action="/weblinks/{{ item.id }}/delete" method="post" data-confirm="Delete this link?" style="display:inline">
<button type="submit" class="btn btn-ghost btn-xs" style="color: var(--red)">Del</button>