feat: add links to contacts with role (combo box with suggestions)
New contact_links junction table. Contact detail page shows linked links with add form (link picker + role datalist combo) and unlink/edit actions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,4 +22,51 @@
|
||||
{% if item.tags %}<div class="form-group full-width"><div class="form-label">Tags</div><div class="flex gap-2">{% for tag in item.tags %}<span class="row-tag">{{ tag }}</span>{% endfor %}</div></div>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Links -->
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Links</h2>
|
||||
</div>
|
||||
<form action="/contacts/{{ item.id }}/links/add" method="post" class="flex gap-2 items-end" style="padding: 12px; border-bottom: 1px solid var(--border);">
|
||||
<div class="form-group" style="flex:2; margin:0;">
|
||||
<label class="form-label">Link</label>
|
||||
<select name="link_id" class="form-select" required>
|
||||
<option value="">Select link...</option>
|
||||
{% for l in all_links %}
|
||||
<option value="{{ l.id }}">{{ l.label }} — {{ l.url[:40] }}{% if l.url|length > 40 %}...{% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" style="flex:1; margin:0;">
|
||||
<label class="form-label">Role</label>
|
||||
<input type="text" name="role" class="form-input" list="link-roles" placeholder="e.g. website, portfolio...">
|
||||
<datalist id="link-roles">
|
||||
<option value="website">
|
||||
<option value="portfolio">
|
||||
<option value="social">
|
||||
<option value="documentation">
|
||||
<option value="reference">
|
||||
<option value="profile">
|
||||
<option value="repository">
|
||||
</datalist>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-sm">Add</button>
|
||||
</form>
|
||||
{% for l in links %}
|
||||
<div class="list-row">
|
||||
<span class="row-title"><a href="{{ l.url }}" target="_blank">{{ l.label }}</a></span>
|
||||
<span class="row-meta">{{ l.url[:50] }}{% if l.url|length > 50 %}...{% endif %}</span>
|
||||
{% if l.role %}<span class="row-tag">{{ l.role }}</span>{% endif %}
|
||||
<div class="row-actions">
|
||||
<a href="/links/{{ l.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
|
||||
<form action="/contacts/{{ item.id }}/links/{{ l.id }}/remove" method="post" style="display:inline">
|
||||
<button class="btn btn-ghost btn-xs">Unlink</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-sm text-muted" style="padding: 12px;">No links</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user