Add custom source input for manually adding communities
- Add 'Custom Source' text input field to polling form - Allows manual entry of subreddits (r/subreddit) or RSS URLs - Custom input overrides dropdown selection if filled - Dropdown becomes optional when custom source is entered - Backend prioritizes custom_source_id over dropdown source_id 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,13 @@
|
||||
<select class="form-select" name="source_id" id="source_id" required onchange="updateDisplayName()">
|
||||
<option value="">Select source...</option>
|
||||
</select>
|
||||
<p class="help-text">Or enter custom source below</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="custom_source_id">Custom Source (optional)</label>
|
||||
<input type="text" class="form-input" name="custom_source_id" id="custom_source_id" placeholder="e.g., r/technology or https://example.com/feed.xml">
|
||||
<p class="help-text">For Reddit: r/subreddit | For RSS: full URL | Leave blank to use dropdown</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -370,6 +377,16 @@
|
||||
displayNameInput.value = selectedOption.dataset.displayName;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle custom source input - make dropdown optional when custom is filled
|
||||
document.getElementById('custom_source_id').addEventListener('input', function() {
|
||||
const sourceSelect = document.getElementById('source_id');
|
||||
if (this.value.trim()) {
|
||||
sourceSelect.removeAttribute('required');
|
||||
} else {
|
||||
sourceSelect.setAttribute('required', 'required');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user