fix: Expose getSchemaProperty, disable upload widget, handle bracket notation arrays

Multiple fixes for array-of-objects and form processing:

1. Expose getSchemaProperty to window (plugins_manager.js):
   - getSchemaProperty was defined inside IIFE but needed by global functions
   - Added window.getSchemaProperty = getSchemaProperty before IIFE closes
   - Updated window.addArrayObjectItem to use window.getSchemaProperty
   - Fixes ReferenceError when dynamically adding array items

2. Disable upload widget for custom feeds (plugin_config.html):
   - File input and Upload button were still active but should be disabled
   - Removed onchange/onclick handlers, added disabled and aria-disabled
   - Added visible disabled styling and tooltip
   - Existing logos continue to display but uploads are prevented
   - Matches PR objectives to disable upload until fully implemented

3. Handle bracket notation array fields (api_v3.py):
   - checkbox-group uses name="field_name[]" which sends multiple values
   - request.form.to_dict() collapses duplicate keys (only keeps last value)
   - Added handling to detect fields ending with "[]" before to_dict()
   - Use request.form.getlist() to get all values, combine as comma-separated
   - Processed before existing array index field handling
   - Fixes checkbox-group losing all but last selected value
This commit is contained in:
Chuck
2026-01-08 13:45:23 -05:00
parent 8c2e3500bf
commit deef9a1e1e
3 changed files with 36 additions and 6 deletions

View File

@@ -232,10 +232,13 @@
id="{{ field_id }}_logo_{{ item_index }}"
accept="image/png,image/jpeg,image/bmp,image/gif"
style="display: none;"
onchange="handleCustomFeedLogoUpload(event, '{{ field_id }}', {{ item_index }}, '{{ plugin_id }}', '{{ full_key }}')">
disabled
aria-disabled="true">
<button type="button"
onclick="document.getElementById('{{ field_id }}_logo_{{ item_index }}').click()"
class="px-2 py-1 text-xs bg-gray-200 hover:bg-gray-300 rounded">
disabled
aria-disabled="true"
class="px-2 py-1 text-xs bg-gray-200 text-gray-400 rounded cursor-not-allowed opacity-50"
title="Logo upload for custom feeds is not yet implemented">
<i class="fas fa-upload mr-1"></i> Upload
</button>
{% if logo_path %}