DRYing the project

This commit is contained in:
2026-02-05 21:23:59 -05:00
parent 079f1c1d49
commit ac9a8d145f
11 changed files with 168 additions and 200 deletions
+26 -11
View File
@@ -4,7 +4,7 @@ A Flask-based image repository with Celery task processing for importing, organi
> **IMPORTANT**: This summary must be kept up to date with any code changes. Update the timestamp below when making modifications.
>
> **Last Updated**: 2026-02-04 (Pixiv sidecar support, Tags navbar dropdown, tag search)
> **Last Updated**: 2026-02-05 (Consolidated JS utilities, shared modal template, Tags dropdown gap fix)
---
@@ -346,25 +346,40 @@ Import tasks support two modes based on `context.deep_scan`:
| Template | Purpose |
|----------|---------|
| `layout.html` | Base template with navbar |
| `showcase.html` | Random image masonry view |
| `gallery.html` | Main gallery with infinite scroll, timeline sidebar, bulk editor, series editor |
| `layout.html` | Base template with navbar (includes Tags dropdown) |
| `showcase.html` | Random image masonry view (extends layout, includes `_gallery_modal.html`) |
| `gallery.html` | Main gallery with infinite scroll, timeline sidebar, bulk editor (includes `_gallery_modal.html`) |
| `reader.html` | Series reader with vertical scroll, page jump, thumbnail navigation |
| `tags_list.html` | Tag browser with preview images |
| `tags_list.html` | Tag browser with preview images and infinite scroll |
| `settings.html` | Import settings, deletion tools, duplicate detection, maintenance tools |
| `_gallery_item.html` | Single gallery item partial (with tag overlay icons) |
| `_gallery_modal.html` | Image modal with tag editor and series management |
| `_pagination.html` | Pagination controls |
| `_gallery_modal.html` | **Shared** image modal with tag editor and series management (used by gallery & showcase) |
| `_tag_cards.html` | Tag card grid partial for tag list |
| `_pagination.html` | Legacy pagination controls |
| `_pagination_floating.html` | Floating pagination indicator |
**Template Inheritance**:
```
layout.html (base)
├── gallery.html (includes: _gallery_item.html, _gallery_modal.html)
├── showcase.html (includes: _gallery_modal.html)
├── reader.html
├── tags_list.html (includes: _tag_cards.html)
└── settings.html
```
### JavaScript Files (`app/static/js/`)
| File | Purpose |
|------|---------|
| `gallery-infinite.js` | Infinite scroll, timeline navigation |
| `view-modal.js` | Modal image navigation, tag editing, series management (add/update/move) |
| `bulk-select.js` | Multi-select with ordered selection, bulk tag editing, tag refresh, series bulk-add |
| `tag-utils.js` | **Shared utility module** - `getTagIcon()`, `getTagDisplayName()`, `escapeHtml()`, `createTagChipHtml()` used by all tag-related JS |
| `gallery-infinite.js` | Infinite scroll, timeline navigation (uses TagUtils) |
| `view-modal.js` | Modal image navigation, tag editing, series management (uses TagUtils) |
| `bulk-select.js` | Multi-select with ordered selection, bulk tag editing, tag refresh (uses TagUtils) |
| `tag-editor.js` | Tag autocomplete and editing |
| `showcase.js` | Showcase shuffle functionality |
| `showcase.js` | Showcase masonry layout and shuffle functionality (uses TagUtils) |
**Script Loading Order**: `tag-utils.js` must be loaded before other JS files that depend on `window.TagUtils`.
---