mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-02-05 02:47:08 +08:00
Implement a sleek inline tag editor with autocomplete and AJAX support: - Create TagEditorWidget and InlineTagEditorWidget in core/widgets.py - Pills display with X remove button, sorted alphabetically - Text input with HTML5 datalist autocomplete - Enter/Space/Comma to add tags, auto-creates if doesn't exist - Backspace removes last tag when input is empty - Add API endpoints in api/v1_core.py - GET /tags/autocomplete/ - search tags by name - POST /tags/create/ - get_or_create tag - POST /tags/add-to-snapshot/ - add tag to snapshot via AJAX - POST /tags/remove-from-snapshot/ - remove tag from snapshot - Update admin_snapshots.py - Replace FilteredSelectMultiple with TagEditorWidget in bulk actions - Create SnapshotAdminForm with tags_editor field - Update title_str() to render inline tag editor in list view - Remove TagInline, use widget instead - Add CSS styles in templates/admin/base.html - Blue gradient pill styling matching admin theme - Focus ring and hover states - Compact inline variant for list view <!-- IMPORTANT: Do not submit PRs with only formatting / PEP8 / line length changes. --> # Summary <!--e.g. This PR fixes ABC or adds the ability to do XYZ...--> # Related issues <!-- e.g. #123 or Roadmap goal # https://github.com/pirate/ArchiveBox/wiki/Roadmap --> # Changes these areas - [ ] Bugfixes - [ ] Feature behavior - [ ] Command line interface - [ ] Configuration options - [ ] Internal architecture - [ ] Snapshot data layout on disk <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Implemented a new interactive tags editor for Django admin with autocomplete and AJAX add/remove, replacing the old multi-select and inline. This makes tagging snapshots faster and safer in detail, list, and bulk actions. - **New Features** - TagEditorWidget and InlineTagEditorWidget with pill UI and remove buttons, XSS-safe rendering, and delegated events. - Keyboard support: Enter/Space/Comma to add, Backspace to remove last when input is empty. - Datalist autocomplete and debounced search via GET /tags/autocomplete/. - AJAX endpoints: POST /tags/create/, /tags/add-to-snapshot/, /tags/remove-from-snapshot/. - **Refactors** - Replaced FilteredSelectMultiple with TagEditorWidget in bulk actions; parse comma-separated tags and use bulk_create/delete for efficient add/remove. - Added SnapshotAdminForm with tags_editor field; saves tags case-insensitively and fixes remove_tags matching. - Rendered inline tag editor in list view via title_str; removed TagInline. - Added CSS in admin/base.html for pill styling, focus ring, and compact inline variant. <sup>Written for commit 0dee662f41184e4d28508d9ff1c6477bef488b85. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. -->