updates for PR creation

This commit is contained in:
overcuriousity
2025-07-25 14:23:21 +02:00
parent bb26d9a80d
commit f21d5b33e3
4 changed files with 58 additions and 52 deletions

View File

@@ -153,17 +153,11 @@ const title = isEdit ? `Edit ${editTool?.name}` : 'Beitrag erstellen';
</label>
<select id="tool-phases" name="phases" multiple size="4">
{phases.map(phase => (
<option value={phase.id}
<option value={phase.id}
selected={editTool?.phases?.includes(phase.id)}>
{phase.name}
</option>
))}
{domainAgnosticSoftware.map(section => (
<option value={section.id}
selected={editTool?.phases?.includes(section.id)}>
{section.name}
</option>
))}
</select>
<div class="field-help">Zutreffende auswählen</div>
</div>
@@ -231,6 +225,22 @@ const title = isEdit ? `Edit ${editTool?.name}` : 'Beitrag erstellen';
<option value="service" selected={editTool?.accessType === 'service'}>Service</option>
</select>
</div>
<!-- Domain-Agnostic Categories -->
<div style="grid-column: 1 / -1;" id="domain-agnostic-field">
<label style="display: block; margin-bottom: 0.5rem; font-weight: 600;">
Domain-Agnostic Categories
</label>
<div id="domain-agnostic-checkboxes" style="display: grid; gap: 0.25rem; font-size: 0.875rem;">
{domainAgnosticSoftware.map(cat => (
<label class="checkbox-wrapper" style="margin-bottom: 0.25rem;">
<input type="checkbox" name="domainAgnostic" value={cat.id} checked={editTool?.['domain-agnostic-software']?.includes(cat.id)} />
<span>{cat.name}</span>
</label>
))}
</div>
</div>
</div>
</div>
@@ -423,7 +433,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Field groups
const softwareFields = document.getElementById('software-fields');
const projectUrlField = document.getElementById('project-url-field');
const domainAgnosticField = document.getElementById('domain-agnostic-field');
const relatedConceptsField = document.getElementById('related-concepts-field');
// Required indicators
@@ -459,10 +469,6 @@ document.addEventListener('DOMContentLoaded', () => {
if (softwareFields) softwareFields.style.display = 'none';
if (relatedConceptsField) relatedConceptsField.style.display = 'none';
// Show project URL for software only
if (projectUrlField) {
projectUrlField.style.display = selectedType === 'software' ? 'block' : 'none';
}
// Handle required fields
const platformsCheckboxes = document.querySelectorAll('input[name="platforms"]');
@@ -476,8 +482,13 @@ document.addEventListener('DOMContentLoaded', () => {
// Make platforms and license required
if (platformsRequired) platformsRequired.style.display = 'inline';
if (licenseRequired) licenseRequired.style.display = 'inline';
platformsCheckboxes.forEach(cb => cb.setAttribute('required', 'required'));
if (platformsCheckboxes.length > 0) {
platformsCheckboxes.forEach(cb => cb.removeAttribute('required'));
platformsCheckboxes[0].setAttribute('required', 'required');
}
if (licenseSelect) licenseSelect.setAttribute('required', 'required');
if (domainAgnosticField) domainAgnosticField.style.display = 'block';
} else {
// Hide required indicators and remove requirements
@@ -485,7 +496,9 @@ document.addEventListener('DOMContentLoaded', () => {
if (licenseRequired) licenseRequired.style.display = 'none';
platformsCheckboxes.forEach(cb => cb.removeAttribute('required'));
if (licenseSelect) licenseSelect.removeAttribute('required');
if (domainAgnosticField) domainAgnosticField.style.display = 'none';
// Show related concepts for methods
if (selectedType === 'method' && relatedConceptsField) {
relatedConceptsField.style.display = 'block';
@@ -520,7 +533,7 @@ document.addEventListener('DOMContentLoaded', () => {
toolData.platforms = formData.getAll('platforms') || [];
toolData.license = formData.get('license')?.trim() || null;
toolData.accessType = formData.get('accessType') || null;
toolData.projectUrl = formData.get('projectUrl') || null;
toolData['domain-agnostic-software'] = formData.getAll('domainAgnostic') || [];
} else {
toolData.platforms = [];
toolData.license = null;
@@ -551,8 +564,8 @@ skillLevel: ${toolData.skillLevel}
url: "${toolData.url}"${toolData.platforms.length > 0 ? `
platforms: [${toolData.platforms.map(p => `"${p}"`).join(', ')}]` : ''}${toolData.license ? `
license: "${toolData.license}"` : ''}${toolData.accessType ? `
accessType: ${toolData.accessType}` : ''}${toolData.projectUrl ? `
projectUrl: "${toolData.projectUrl}"` : ''}${toolData.knowledgebase ? `
accessType: ${toolData.accessType}` : ''}${toolData['domain-agnostic-software'] && toolData['domain-agnostic-software'].length > 0 ? `
domain-agnostic-software: [${toolData['domain-agnostic-software'].map(c => `"${c}"`).join(', ')}]` : ''}${toolData.knowledgebase ? `
knowledgebase: true` : ''}${toolData.tags.length > 0 ? `
tags: [${toolData.tags.map(t => `"${t}"`).join(', ')}]` : ''}${toolData.related_concepts ? `
related_concepts: [${toolData.related_concepts.map(c => `"${c}"`).join(', ')}]` : ''}`;
@@ -660,7 +673,8 @@ related_concepts: [${toolData.related_concepts.map(c => `"${c}"`).join(', ')}]`
submissionData.tool.platforms = formData.getAll('platforms');
submissionData.tool.license = formData.get('license')?.trim() || null;
submissionData.tool.accessType = formData.get('accessType') || null;
submissionData.tool.projectUrl = formData.get('projectUrl')?.trim() || null;
const da = formData.getAll('domainAgnostic');
if (da.length > 0) submissionData.tool['domain-agnostic-software'] = da;
}
// Add optional fields