Remove duplicate array-of-objects check

This commit is contained in:
Chuck
2026-01-04 19:57:19 -05:00
parent a9351f1c66
commit 7d67495285

View File

@@ -3049,36 +3049,6 @@ function generateFieldHtml(key, prop, value, prefix = '') {
`;
});
html += `</div>`;
} else if (prop.items && prop.items.type === 'object' && prop.items.properties) {
// Array of objects widget (like custom_feeds with name, url, enabled, logo)
console.log(`[DEBUG] ✅ Detected array-of-objects widget for ${fullKey}`);
const fieldId = fullKey.replace(/\./g, '_');
const itemsSchema = prop.items;
const itemProperties = itemsSchema.properties || {};
const maxItems = prop.maxItems || 50;
const currentItems = Array.isArray(value) ? value : [];
html += `
<div class="array-of-objects-container mt-1">
<div id="${fieldId}_items" class="space-y-4">
`;
// Render existing items
currentItems.forEach((item, index) => {
html += renderArrayObjectItem(fieldId, fullKey, itemProperties, item, index, itemsSchema);
});
html += `
</div>
<button type="button"
onclick="addArrayObjectItem('${fieldId}', '${fullKey}', ${maxItems})"
class="mt-3 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors"
${currentItems.length >= maxItems ? 'disabled style="opacity: 0.5; cursor: not-allowed;"' : ''}>
<i class="fas fa-plus mr-1"></i> Add Feed
</button>
<input type="hidden" id="${fieldId}_data" name="${fullKey}_data" value='${JSON.stringify(currentItems).replace(/'/g, "&#39;")}'>
</div>
`;
} else {
// Regular array input
console.log(`[DEBUG] ❌ NOT a file upload widget for ${fullKey}, using regular array input`);