Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A learning project for a ticket board with TODO, DOING, and DONE columns. The ow

## Current features

- Create tickets in any column, edit titles inline in a textarea beside the actions button, and delete tickets. While editing, Enter adds a line, Ctrl/⌘ + Enter saves, and Escape cancels. Saved titles preserve line breaks on the card.
- Cards show the title, a three-dot actions button, and a small indicator when blocked. Hover over the actions button for 250 ms or click/tap it to open movement, blocking, deletion, and drag controls. Keyboard users can open it with Enter/Space or Arrow Down, Tab through actions, and close it with Escape. The drag control also supports left/right arrow keys.
- Create tickets in any column, click a card outside its actions menu to edit its title inline in a textarea beside the actions button, and delete tickets. While editing, Enter adds a line, Ctrl/⌘ + Enter saves, and Escape cancels. Saved titles preserve line breaks on the card.
- Cards show the title, a three-dot actions button, and a small indicator when blocked. Drag a card to another column to move it; dragging is disabled while editing or saving. Hover over the actions button for 250 ms or click/tap it to open movement, blocking, deletion, and drag controls. Menu clicks do not open the title editor. Keyboard users can open the menu with Enter/Space or Arrow Down, Tab through actions, and close it with Escape. The drag control also supports left/right arrow keys.
- Add tickets with an explicit Add button or Enter. The actions panel contains a shortened UUID reference; the full identifier is retained in API requests and available in the reference tooltip.
- Submit blocking requests, record or edit a blocking reason, and unblock tickets.
- Refresh the board manually to load the current server state.
Expand Down
29 changes: 25 additions & 4 deletions src/main/resources/META-INF/resources/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ async function runCard(id, action, focusTarget = '.ticket-title') {
updateRefresh();
clearDrag();
card.setAttribute('aria-busy', 'true');
card.draggable = false;
controls.forEach(control => { control.disabled = true; });
const message = card.querySelector('.ticket-feedback');
message.classList.remove('error', 'sr-only');
Expand All @@ -190,6 +191,7 @@ async function runCard(id, action, focusTarget = '.ticket-title') {
updateRefresh();
if (card.isConnected) {
card.removeAttribute('aria-busy');
card.draggable = !editingTickets.has(id);
controls.forEach((control, index) => { control.disabled = disabled[index]; });
}
if (document.activeElement === document.body || card.contains(document.activeElement)) {
Expand Down Expand Up @@ -246,6 +248,7 @@ function openInlineEditor(id, mode) {
const card = cardFor(id);
editingTickets.add(id);
card.classList.add('editing');
card.draggable = false;
closeTicketMenus();
card.querySelectorAll('button').forEach(control => { control.disabled = true; });
card.querySelector('.ticket-feedback').textContent = '';
Expand Down Expand Up @@ -307,11 +310,24 @@ function ticketCard(ticket) {
const id = String(ticket.id);
const card = element('article', `ticket${ticket.blocked ? ' blocked' : ''}`);
card.dataset.ticketId = id;
card.draggable = true;
let suppressClick = false;
card.addEventListener('pointerdown', event => {
card.draggable = !refreshing && !pendingTickets.has(id) && !editingTickets.has(id)
&& (!event.target.closest('.ticket-menu') || !!event.target.closest('.drag-handle'));
});
card.addEventListener('click', event => {
if (suppressClick || event.target.closest('.ticket-menu, .inline-editor')) return;
if (editingTickets.has(id)) {
card.querySelector('textarea[name="title"]')?.focus();
return;
}
openInlineEditor(id, 'title');
});
const header = element('div', 'ticket-header');
const heading = element('h3', 'ticket-heading');
const title = button(ticket.title, 'ticket-title', `Edit title of ticket ${id}: ${ticket.title}`);
title.title = ticket.blocked ? `Blocked: ${ticket.blockedNote}` : 'Click to edit title';
title.addEventListener('click', () => openInlineEditor(id, 'title'));
heading.append(title);
if (ticket.blocked) {
const badge = element('span', 'blocked-indicator');
Expand Down Expand Up @@ -397,18 +413,23 @@ function ticketCard(ticket) {
const destination = statuses[statuses.indexOf(ticket.status) + direction];
if (destination) moveTicket(id, destination);
});
handle.addEventListener('dragstart', event => {
if (refreshing || pendingTickets.has(id) || editingTickets.has(id)) {
card.addEventListener('dragstart', event => {
if (refreshing || pendingTickets.has(id) || editingTickets.has(id) || !card.draggable) {
event.preventDefault();
return;
}
suppressClick = true;
closeTicketMenus();
draggedTicketId = id;
event.dataTransfer.setData('text/plain', id);
event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setDragImage(card, card.offsetWidth / 2, 20);
card.classList.add('dragging');
});
handle.addEventListener('dragend', clearDrag);
card.addEventListener('dragend', () => {
clearDrag();
setTimeout(() => { suppressClick = false; }, 0);
});
const remove = actionButton('Delete ticket', 'trash', 'quiet danger', `Delete ticket ${id}: ${ticket.title}`);
remove.title = 'Delete ticket';
remove.addEventListener('click', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2 id="done-heading">DONE <span class="count">0</span></h2>
</form>
</section>
</div>
<p class="hint">Click a title to edit. Enter adds a line; Ctrl/⌘ + Enter saves; Esc cancels. Hover over ⋯ briefly or click it for ticket actions, including moving and blocking.</p>
<p class="hint">Drag a card to move it, or click it to edit its title. Enter adds a line; Ctrl/⌘ + Enter saves; Esc cancels. Hover over ⋯ briefly or click it for ticket actions, including moving and blocking.</p>
</main>

</body>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ h2 { font-size: .75rem; font-weight: 650; letter-spacing: .09em; margin: 0 0 18p
border-radius: 10px; min-width: 0; box-shadow: 0 3px 8px var(--ticket-shadow);
}
.ticket:hover { border-color: var(--ticket-hover-border); }
.ticket[draggable="true"] { cursor: grab; }
.ticket[draggable="true"]:active { cursor: grabbing; }
.ticket[draggable="true"] .ticket-title { cursor: inherit; user-select: none; }
.ticket.blocked { border-left: 3px solid var(--warning); }
.ticket.dragging { opacity: .45; }
.ticket-header { display: flex; align-items: flex-start; gap: 6px; }
Expand Down