- Add custom border, background, and spacing utilities to base template - Enhance message notification styling and layout - Update delete modal button appearance and behavior - Refine comment card component with Tailwind classes and responsive behavior - Adjust sidebar responsiveness for mobile view
95 lines
5.0 KiB
HTML
95 lines
5.0 KiB
HTML
{% extends "base_authenticated.html" %}
|
|
{% load form_helpers %}
|
|
{% block title %}{% if is_create %}New Card{% else %}Edit Card{% endif %}{% endblock %}
|
|
{% block content_inner %}
|
|
<div class="max-w-3xl mx-auto">
|
|
<div class="flex items-center gap-2 text-sm text-tertiary mb-4">
|
|
<a href="{% url 'board_list' %}" class="hover:text-blue-600">Boards</a>
|
|
<span>/</span>
|
|
<a href="{% url 'board_detail' board.pk %}" class="hover:text-blue-600">{{ board.name }}</a>
|
|
<span>/</span>
|
|
<span class="text-primary">{% if is_create %}New Card{% else %}{{ object.title|truncatechars:30 }}{% endif %}</span>
|
|
</div>
|
|
|
|
<div class="card-surface overflow-hidden">
|
|
<div class="p-6">
|
|
<h1 class="text-xl font-bold text-primary mb-1">{% if is_create %}New Card{% else %}Edit Card{% endif %}</h1>
|
|
<p class="text-sm text-tertiary mb-6">Column: <strong>{{ column.name }}</strong></p>
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
{% for field in form %}
|
|
<div class="{% if field.name == 'title' or field.name == 'description' %}md:col-span-2{% endif %}">
|
|
{% include "partials/form_field.html" %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="flex gap-3 pt-4 mt-4 border-t border-subtle">
|
|
<button type="submit" class="px-3 py-1.5 rounded-lg text-sm font-medium bg-blue-600 text-white hover:bg-blue-700 transition-colors">
|
|
{% if is_create %}Create Card{% else %}Save Changes{% endif %}
|
|
</button>
|
|
<a href="{% url 'board_detail' board.pk %}" class="px-3 py-1.5 rounded-lg text-sm font-medium text-secondary hover:bg-hover border border-soft transition-colors">Cancel</a>
|
|
{% if not is_create %}
|
|
<label for="card-delete-modal" class="px-3 py-1.5 rounded-lg text-sm font-medium bg-red-50 text-red-700 hover:bg-red-100 border border-red-200 transition-colors ml-auto cursor-pointer">Delete</label>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
{% if not is_create and comments is not None %}
|
|
<div class="card-surface overflow-hidden mt-6">
|
|
<div class="px-6 py-4 border-b border-subtle">
|
|
<h2 class="font-semibold text-primary">Comments ({{ comments.count }})</h2>
|
|
</div>
|
|
<div class="p-6">
|
|
<div id="comment-list" class="space-y-4 mb-6">
|
|
{% for comment in comments %}
|
|
{% include "partials/kanban/comment.html" %}
|
|
{% empty %}
|
|
<p class="text-sm text-muted text-center py-4">No comments yet.</p>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<form method="post" action="{% url 'card_comment' object.pk %}"
|
|
hx-target="#comment-list" hx-swap="beforeend"
|
|
class="border-t border-subtle pt-4">
|
|
{% csrf_token %}
|
|
<label class="text-sm font-medium text-secondary mb-2 block">Add a comment</label>
|
|
<textarea name="body" class="w-full px-3 py-2 rounded-lg border border-soft bg-white text-sm text-primary focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 transition-colors resize-y min-h-[100px]" placeholder="Write your comment... (Markdown supported)"></textarea>
|
|
<button type="submit" class="mt-2 px-3 py-1.5 rounded-lg text-sm font-medium bg-blue-600 text-white hover:bg-blue-700 transition-colors">Post Comment</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|
|
{% if not is_create %}
|
|
{% include "components/delete_modal.html" with modal_id="card-delete-modal" title="Delete Card" message="Are you sure you want to delete this card? This action cannot be undone." delete_url="/cards/{{ object.pk }}/delete/" %}
|
|
{% endif %}
|
|
{% block extra_scripts %}
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const desc = document.querySelector('textarea[name="description"]');
|
|
if (desc) {
|
|
new EasyMDE({
|
|
element: desc,
|
|
spellChecker: false,
|
|
autosave: { enabled: false },
|
|
toolbar: ['bold', 'italic', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', '|', 'link', 'code', 'table', '|', 'preview', 'guide'],
|
|
});
|
|
}
|
|
{% if not is_create %}
|
|
const commentFields = document.querySelectorAll('textarea[name="body"]');
|
|
commentFields.forEach(el => {
|
|
new EasyMDE({
|
|
element: el,
|
|
spellChecker: false,
|
|
toolbar: ['bold', 'italic', 'quote', '|', 'code', 'link', '|', 'preview'],
|
|
});
|
|
});
|
|
{% endif %}
|
|
});
|
|
</script>
|
|
{% endblock %}
|