latest changes
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{% if files %}<ul class="list-unstyled mb-2">
|
||||
{% for file in files %}<li class="d-flex flex-wrap align-items-center gap-2 border rounded p-2 mb-2">
|
||||
<a href="{% url 'projects:attachment_download' file.id %}">{{ file.title }}</a>
|
||||
{% if file.byte_size <= 1048576 and file.mime_type == 'image/png' or file.byte_size <= 1048576 and file.mime_type == 'image/jpeg' or file.byte_size <= 1048576 and file.mime_type == 'image/webp' %}<a href="{% url 'projects:attachment_preview' file.id %}" target="_blank" rel="noopener" aria-label="Preview {{ file.title }}"><img src="{% url 'projects:attachment_preview' file.id %}" alt="" style="max-width:5rem;max-height:5rem;object-fit:contain"></a>{% elif file.mime_type == 'text/plain' and file.byte_size <= 1048576 %}<a href="{% url 'projects:attachment_preview' file.id %}" target="_blank" rel="noopener">Preview text</a>{% endif %}
|
||||
<small class="text-muted">{{ file.byte_size|filesizeformat }} · {{ file.created_at|date:'SHORT_DATETIME_FORMAT' }}{% if file.uploaded_by %} · {{ file.uploaded_by }}{% endif %}</small>
|
||||
{% if file.source_path %}<small class="text-muted">Snapshot: {{ file.source_path }}{% if file.source_commit %} @ {{ file.source_commit|slice:':12' }}{% endif %}</small>{% endif %}
|
||||
{% if can_edit %}<details><summary>Rename</summary><form method="post" action="{% url 'projects:attachment_update' file.id %}">{% csrf_token %}<label for="attachment-title-{{ file.id }}">Display title</label><input id="attachment-title-{{ file.id }}" name="title" maxlength="255" required value="{{ file.title }}"><button type="submit" class="btn btn-outline-secondary btn-sm">Save</button></form></details><form method="post" action="{% url 'projects:attachment_delete' file.id %}" onsubmit="return confirm('Delete this attachment?')">{% csrf_token %}<button type="submit" class="btn btn-outline-danger btn-sm" aria-label="Delete {{ file.title }}">Delete</button></form>{% endif %}
|
||||
</li>{% endfor %}</ul>{% else %}<p class="text-muted">No files attached.</p>{% endif %}
|
||||
@@ -15,6 +15,7 @@
|
||||
{% for card in column.visible_cards %}
|
||||
<article class="card mb-2" data-move="{% url 'projects:card_move' card.id %}">
|
||||
<div class="card-body">
|
||||
{% if can_edit and not show_archived %}<label class="d-block mb-1"><input type="checkbox" class="bulk-card-choice" value="{{ card.id }}" aria-label="Select {{ card.title }} for bulk edit"> Select</label>{% endif %}
|
||||
<a href="{% url 'projects:card' card.id %}"><strong>{{ card.title }}</strong></a>
|
||||
<div><span class="badge text-bg-secondary">{{ card.get_priority_display }}</span> <small>{{ card.get_card_type_display }}</small>{% if card.is_blocked %}<span class="badge text-bg-danger">Blocked</span>{% endif %}</div>
|
||||
{% if can_edit %}<form method="post" action="{% url 'projects:card_move' card.id %}" class="mt-2">
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<div class="col-auto"><a class="btn btn-outline-secondary" href="{% url 'projects:board' project.id %}">Clear</a></div>
|
||||
</form>
|
||||
<span id="board-search-loading" class="htmx-indicator" role="status">Searching…</span>
|
||||
{% if can_edit and not show_archived %}<div class="d-flex align-items-center gap-2 mb-2" id="bulk-toolbar"><span id="bulk-count" role="status" aria-live="polite">0 cards selected</span><button type="button" class="btn btn-outline-primary btn-sm" id="bulk-edit-button" disabled>Bulk edit</button><button type="button" class="btn btn-outline-secondary btn-sm" id="bulk-clear-button">Clear selection</button></div>{% endif %}
|
||||
<div id="board-results">{% include 'projects/_board.html' %}</div>
|
||||
{% if can_edit %}<a class="btn btn-outline-secondary mt-3" href="{% url 'projects:column_create' project.id %}">Add column</a>
|
||||
<a class="btn btn-outline-secondary mt-3" href="{% url 'projects:tag_create' project.id %}">Add tag</a>{% endif %}
|
||||
@@ -39,6 +40,16 @@ function wireBoard() {
|
||||
}});
|
||||
}
|
||||
wireBoard(); document.body.addEventListener('htmx:afterSwap', wireBoard);
|
||||
const bulkCount = document.getElementById('bulk-count');
|
||||
function selectedBulkCards() { return [...document.querySelectorAll('.bulk-card-choice:checked')]; }
|
||||
function updateBulkCount() { if (!bulkCount) return; const n = selectedBulkCards().length; bulkCount.textContent = `${n} card${n === 1 ? '' : 's'} selected`; document.getElementById('bulk-edit-button').disabled = n === 0; }
|
||||
document.addEventListener('change', event => { if (event.target.matches('.bulk-card-choice')) updateBulkCount(); });
|
||||
document.getElementById('bulk-clear-button')?.addEventListener('click', () => { selectedBulkCards().forEach(box => box.checked = false); updateBulkCount(); });
|
||||
document.getElementById('bulk-edit-button')?.addEventListener('click', () => {
|
||||
const query = new URLSearchParams(); selectedBulkCards().forEach(box => query.append('card', box.value));
|
||||
location.href = '{% url 'projects:cards_bulk_edit' project.id %}?' + query.toString();
|
||||
});
|
||||
document.body.addEventListener('htmx:afterSwap', updateBulkCount);
|
||||
</script>
|
||||
{% csrf_token %}
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{% extends 'core/base.html' %}
|
||||
{% block content %}
|
||||
<a href="{% url 'projects:board' project.id %}">← Back to {{ project.name }}</a>
|
||||
<h1 class="mt-2">Bulk edit {{ cards|length }} card{{ cards|length|pluralize }}</h1>
|
||||
<p>Choose the fields to change. Preview shows each card's exact changes before you apply them.</p>
|
||||
<details><summary>Selected cards</summary><ul>{% for card in cards %}<li>{{ card.title }} · revision {{ card.revision }}</li>{% endfor %}</ul></details>
|
||||
{% if error %}<div class="alert alert-danger" role="alert">{{ error }}</div>{% endif %}
|
||||
{% if applied %}<div class="alert alert-success" role="status">Updated {{ applied.changed_count }} card{{ applied.changed_count|pluralize }}. {{ applied.unchanged_count }} were already up to date. <a href="{% url 'projects:board' project.id %}">Return to board</a></div>{% else %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% for card in cards %}<input type="hidden" name="card" value="{{ card.id }}">{% endfor %}
|
||||
<input type="hidden" name="expected_revisions" value="{{ revisions_json }}">
|
||||
<input type="hidden" name="idempotency_key" value="{{ idempotency_key }}">
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-6"><label><input type="checkbox" name="change_column_id" value="1" {% if request.POST.change_column_id %}checked{% endif %}> Change column</label><select class="form-select" name="column_id" aria-label="New column">{% for column in columns %}<option value="{{ column.id }}" {% if request.POST.column_id == column.id|stringformat:'s' %}selected{% endif %}>{{ column.name }}</option>{% endfor %}</select></div>
|
||||
<div class="col-md-6"><label><input type="checkbox" name="change_priority" value="1" {% if request.POST.change_priority %}checked{% endif %}> Change priority</label><select class="form-select" name="priority" aria-label="New priority"><option value="low" {% if request.POST.priority == 'low' %}selected{% endif %}>Low</option><option value="medium" {% if request.POST.priority == 'medium' %}selected{% endif %}>Medium</option><option value="high" {% if request.POST.priority == 'high' %}selected{% endif %}>High</option></select></div>
|
||||
<div class="col-md-6"><label><input type="checkbox" name="change_assignee_id" value="1" {% if request.POST.change_assignee_id %}checked{% endif %}> Change assignee</label><select class="form-select" name="assignee_id" aria-label="New assignee"><option value="">Unassigned</option>{% for person in assignable %}<option value="{{ person.id }}" {% if request.POST.assignee_id == person.id|stringformat:'s' %}selected{% endif %}>{{ person.username }}</option>{% endfor %}</select></div>
|
||||
<div class="col-md-6"><label><input type="checkbox" name="change_tag_ids" value="1" {% if request.POST.change_tag_ids %}checked{% endif %}> Replace tags</label><select class="form-select" name="tag_ids" multiple size="4" aria-label="New tags">{% for tag in tags %}<option value="{{ tag.id }}" {% if tag.id|stringformat:'s' in selected_tag_ids %}selected{% endif %}>{{ tag.name }}</option>{% endfor %}</select><small>Hold Ctrl or Command to select several; leave empty to clear tags.</small></div>
|
||||
</div>
|
||||
<button class="btn btn-outline-primary" type="submit" name="action" value="preview">Preview changes</button>
|
||||
{% if preview and not applied %}<input type="hidden" name="preview_token" value="{{ preview_token }}"><button class="btn btn-primary" type="submit" name="action" value="apply">Apply changes to {{ preview.changed_count }} card{{ preview.changed_count|pluralize }}</button>{% endif %}
|
||||
</form>
|
||||
{% if preview %}<h2 class="h5 mt-4">Preview: {{ preview.changed_count }} changed, {{ preview.unchanged_count }} unchanged</h2>
|
||||
<ul>{% for item in preview.items %}<li><strong>{{ item.title }}</strong> (revision {{ item.revision }}){% if item.changed %}<ul>{% for field, delta in item.changes.items %}<li>{{ field }}: {{ delta.from }} → {{ delta.to }}</li>{% endfor %}</ul>{% else %} — unchanged{% endif %}</li>{% endfor %}</ul>{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -1,12 +1,18 @@
|
||||
{% extends 'core/base.html' %}{% load project_markdown %}
|
||||
{% extends 'core/base.html' %}{% load project_markdown static %}
|
||||
{% block content %}
|
||||
<a href="{% url 'projects:board' card.project_id %}">← {{ card.project.name }}</a>
|
||||
<div class="d-flex justify-content-between mt-3"><h1>{{ card.title }}</h1>{% if can_edit %}<div><a class="btn btn-outline-secondary" href="{% url 'projects:card_edit' card.id %}">Edit</a> {% if card.archived %}<form method="post" action="{% url 'projects:card_restore' card.id %}" class="d-inline">{% csrf_token %}<button class="btn btn-outline-success">Restore</button></form>{% else %}<form method="post" action="{% url 'projects:card_archive' card.id %}" class="d-inline">{% csrf_token %}<button class="btn btn-outline-danger">Archive</button></form>{% endif %}</div>{% endif %}</div>
|
||||
<p><span class="badge text-bg-secondary">{{ card.get_priority_display }}</span> {{ card.column.name }} · {{ card.get_card_type_display }} · Revision {{ card.revision }}</p>
|
||||
<div class="card card-body mb-4 markdown-body">{{ card.description_markdown|safe_markdown }}</div>
|
||||
<details><summary>Raw Markdown</summary><pre>{{ card.description_markdown }}</pre></details>
|
||||
<section aria-labelledby="card-files-heading" class="mt-4"><h2 id="card-files-heading" class="h4">Card files</h2>
|
||||
{% include 'projects/_attachment_list.html' with files=card_files %}
|
||||
{% if can_edit %}<form method="post" enctype="multipart/form-data" action="{% url 'projects:attachment_upload' card.id %}" class="mb-3" data-attachment-upload>{% csrf_token %}<label for="card-files-input" class="form-label">Add card files</label><input id="card-files-input" class="form-control" type="file" name="files" multiple required><button class="btn btn-outline-primary mt-2">Upload files</button><progress hidden max="100" value="0" aria-label="Upload progress"></progress><span role="status" aria-live="polite"></span></form>{% endif %}</section>
|
||||
<h2 class="h4 mt-4">Progress notes</h2>
|
||||
{% for comment in card.comments.all %}<div class="card card-body mb-2"><small>{{ comment.author }} · {{ comment.created_at }}</small><p>{{ comment.body|linebreaksbr }}</p></div>{% endfor %}
|
||||
{% for comment in comments %}<div class="card card-body mb-2"><small>{{ comment.author }} · {{ comment.created_at }}</small><p>{{ comment.body|linebreaksbr }}</p><h3 class="h6">Files on this progress note</h3>
|
||||
{% include 'projects/_attachment_list.html' with files=comment.attachments.all %}
|
||||
{% if can_edit %}<form method="post" enctype="multipart/form-data" action="{% url 'projects:attachment_upload' card.id %}" data-attachment-upload>{% csrf_token %}<input type="hidden" name="comment_id" value="{{ comment.id }}"><label for="note-files-{{ comment.id }}" class="form-label">Add files to this note</label><input id="note-files-{{ comment.id }}" class="form-control" type="file" name="files" multiple required><button class="btn btn-outline-primary mt-2">Upload files</button><progress hidden max="100" value="0" aria-label="Upload progress"></progress><span role="status" aria-live="polite"></span></form>{% endif %}</div>{% endfor %}
|
||||
{% if can_edit %}<form method="post" action="{% url 'projects:card_comment' card.id %}">{% csrf_token %}<label for="comment">Add note</label><textarea class="form-control" id="comment" name="body" required></textarea><button class="btn btn-success mt-2">Add note</button></form>{% endif %}
|
||||
<h2 class="h4 mt-4">History</h2><ul>{% for event in card.activity.all %}<li>{{ event.created_at }} · {{ event.action }} by {{ event.actor }}</li>{% endfor %}</ul>
|
||||
<script defer src="{% static 'projects/attachments.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user