feat: add label multi-select to Create Issue form
Add dynamic label selection when creating a new issue: - New GET /issues/new/labels endpoint returns label checkboxes for a repo - When a repo is selected, labels are fetched via HTMX and displayed as checkboxes with colored label badges - CreateIssue handler now parses label_ids from form and passes them to the Gitea API - Shows "No labels available" message when repo has no labels Closes leeworks-agents/gitea-mobile#67 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,11 @@
|
||||
<input type="hidden" name="repo" id="repo-input">
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="label-section" style="display:none;">
|
||||
<label>Labels</label>
|
||||
<div id="label-list"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Title</label>
|
||||
<input type="text" id="title" name="title" placeholder="Issue title" required>
|
||||
@@ -52,7 +57,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
repoSelect.addEventListener('change', splitOwnerRepo);
|
||||
repoSelect.addEventListener('change', function() {
|
||||
splitOwnerRepo();
|
||||
var labelSection = document.getElementById('label-section');
|
||||
var labelList = document.getElementById('label-list');
|
||||
if (ownerInput.value && repoInput.value) {
|
||||
labelList.innerHTML = '<span class="empty">Loading labels...</span>';
|
||||
labelSection.style.display = 'block';
|
||||
htmx.ajax('GET', '/issues/new/labels?owner=' + encodeURIComponent(ownerInput.value) + '&repo=' + encodeURIComponent(repoInput.value), {target: '#label-list', swap: 'innerHTML'});
|
||||
} else {
|
||||
labelSection.style.display = 'none';
|
||||
labelList.innerHTML = '';
|
||||
}
|
||||
});
|
||||
|
||||
// Validate before HTMX submit.
|
||||
document.getElementById('create-issue-form').addEventListener('htmx:configRequest', function(evt) {
|
||||
|
||||
Reference in New Issue
Block a user