44 lines
2.4 KiB
Django/Jinja
44 lines
2.4 KiB
Django/Jinja
{% extends 'base.html.j2' %}
|
|
{% block title %}{{ list.name }} | Sigl{% endblock %}
|
|
{% block header %}
|
|
<div class="flex justify-between items-center py-2">
|
|
<div class="text-lg font-bold text-gray-800">Edit {{ list.name }}</div>
|
|
</div>
|
|
{% endblock %}
|
|
{% block main %}
|
|
<form method="post">
|
|
<div class="py-2 px-4 flex flex-col">
|
|
<div class="flex flex-col pb-4">
|
|
<label for="name" class="py-1 text-xs text-gray-700 font-semibold">Shopping List Name:</label>
|
|
<input type="text" name="name" id="name" class="p-1 text-sm border border-gray-200 rounded" value="{{ list.name }}" />
|
|
</div>
|
|
<div class="flex flex-col pb-4">
|
|
<label for="notes" class="py-1 text-xs text-gray-700 font-semibold">Notes:</label>
|
|
<textarea name="notes" id="notes" class="p-1 text-sm border border-gray-200 rounded">{{ list.notes or '' }}</textarea>
|
|
</div>
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex justify-start items-start">
|
|
<a href="{{ url_for('lists.detail', id=list.id) }}" class="px-2 py-1 text-sm text-white bg-gray-600 hover:bg-gray-700 border rounded flex justify-between items-center">
|
|
Cancel
|
|
</a>
|
|
<button type="submit" id="delete-list-btn" class="ml-2 px-2 py-1 text-sm text-white bg-red-600 hover:bg-red-700 border rounded flex justify-between items-center" onclick="deleteList()">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
|
</svg>
|
|
Delete List
|
|
</button>
|
|
</div>
|
|
<button type="submit" class="px-2 py-1 border rounded text-sm text-white bg-blue-600 hover:bg-blue-700">Update</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<form action="{{ url_for('lists.delete', id=list.id) }}" method="post" id="delete-list-form"></form>
|
|
<script language="javascript">
|
|
function deleteList() {
|
|
const form = document.getElementById('delete-list-form');
|
|
if (form && confirm('Are you sure you want to delete list "{{ list.name }}"? This cannot be undone.')) {
|
|
form.submit();
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %} |