feat: create new links directly from contact pages
Contact detail: + New Link button redirects to link form with contact context. Contact create/edit form: inline new link rows (label/url/role) created on submit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<button type="button" class="btn btn-ghost btn-sm" id="add-link-btn">+ Add Link</button>
|
||||
<button type="button" class="btn btn-ghost btn-sm" id="add-new-link-btn">+ Create New Link</button>
|
||||
<datalist id="link-roles">
|
||||
<option value="website">
|
||||
<option value="portfolio">
|
||||
@@ -65,6 +66,15 @@
|
||||
'<button type="button" class="btn btn-ghost btn-xs" style="color:var(--red);" onclick="this.closest(\'.contact-link-row\').remove()">×</button>';
|
||||
document.getElementById('contact-links-list').appendChild(row);
|
||||
});
|
||||
document.getElementById('add-new-link-btn').addEventListener('click', function() {
|
||||
var row = document.createElement('div');
|
||||
row.className = 'flex gap-2 items-center mb-2 contact-link-row';
|
||||
row.innerHTML = '<input type="text" name="new_link_labels" class="form-input" placeholder="Label *" required style="flex:1;">' +
|
||||
'<input type="url" name="new_link_urls" class="form-input" placeholder="URL *" required style="flex:2;">' +
|
||||
'<input type="text" name="new_link_roles" class="form-input" list="link-roles" placeholder="Role..." style="flex:1;">' +
|
||||
'<button type="button" class="btn btn-ghost btn-xs" style="color:var(--red);" onclick="this.closest(\'.contact-link-row\').remove()">×</button>';
|
||||
document.getElementById('contact-links-list').appendChild(row);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user