Add hierarchical tree view for tag categories#3482
Open
oliver-howard wants to merge 5 commits intojaneczku:Developfrom
Open
Add hierarchical tree view for tag categories#3482oliver-howard wants to merge 5 commits intojaneczku:Developfrom
oliver-howard wants to merge 5 commits intojaneczku:Developfrom
Conversation
- Replace custom .count class with Bootstrap's .badge class for theme compatibility - Remove hardcoded colors from tag icons and names to inherit from active theme - Add flexbox constraints to prevent badge overflow and horizontal scrolling - Set max-width: 100% on tag-tree, list items, and tag-node for proper containment - Add min-width: 0 and overflow: hidden to tag names for text truncation - Add flex-shrink: 0 to badges to prevent them from being squeezed out This ensures badges display correctly in both default and custom themes (e.g., caliBlur) without requiring horizontal scrolling.
|
I can't test it now, does it show the categories under opds/category too? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #1185
Currently, Calibre-Web displays all tags as a flat list on the Categories page. When users create hierarchical tags using dot notation (e.g.,
Fantasy.Urban,SciFi.Space.Opera) in Calibre, they appear as separate, individual entries rather than a nested hierarchy. This makes navigation difficult and creates visual clutter for users with large, organized tag collections.Solution
This PR implements hierarchical tag parsing and tree view display for the Categories page. Tags using period separators (
.) are automatically parsed into a nested tree structure with expand/collapse functionality, matching how Calibre handles hierarchical tags.Features Implemented
Core Functionality
›) instead of period for better readability within book viewNavigation Features
Technical Implementation
Backend (cps/helper.py)
Added tag hierarchy parsing and tree building functions:
parse_tag_hierarchy()- Split hierarchical tag names into componentsget_tag_leaf_name()- Extract leaf node from hierarchical tagget_tag_display_name()- Format tags with chevron separatoris_hierarchical_tag()- Check if tag contains hierarchy separatorbuild_tag_tree()- Convert flat tag list to nested tree with aggregated countstree_to_list()- Flatten tree for template rendering with level metadataFrontend
category_list()route to build and sort tree structureDisplay Updates
›) for consistencyAdditional Fix
cli_param.gd_pathto prevent errors when Google Drive is not configuredUsage Example
Users create hierarchical tags in Calibre using period separators:
Fantasy.Urban-Fantasy
Fantasy.Epic.High-Fantasy
SciFi.Dystopian.Space-Opera
These automatically display as an expandable tree in Calibre-Web's Categories page, with parent categories showing aggregated book counts.
Testing
Notes