Improve: Auto-expand parent category and clarify expand/collapse buttons
Improvements to category tree UX: - Auto-expand parent category after creating subcategory at any nesting level - Recursive ancestor expansion using elegant DOM traversal with .closest() - Smooth scroll to newly created category with visual feedback - Replace icon buttons with text: "Развернуть все" / "Свернуть все" - Eliminates confusion between "+" for adding category vs expanding tree Technical implementation: - URL parameter ?expand=<parent_id> to preserve state after page reload - Recursive expandAncestors() function traverses up the DOM tree - Uses :scope selector for precise parent-child relationship queries - Auto-cleans URL parameter after expansion using history.replaceState() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -151,11 +151,11 @@
|
||||
<div class="card shadow-sm border-0 mb-3">
|
||||
<div class="card-header bg-white py-2 d-flex justify-content-between align-items-center">
|
||||
<strong><i class="bi bi-folder-tree text-primary"></i> Категории</strong>
|
||||
<div class="d-flex gap-2">
|
||||
<div class="d-flex gap-2 align-items-center">
|
||||
<i class="bi bi-plus-circle text-success cursor-pointer" id="add-root-category-btn" title="Добавить категорию" style="font-size: 1.2rem; cursor: pointer;"></i>
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button class="btn btn-outline-secondary btn-sm py-0" id="expand-all" title="Развернуть"><i class="bi bi-plus-square"></i></button>
|
||||
<button class="btn btn-outline-secondary btn-sm py-0" id="collapse-all" title="Свернуть"><i class="bi bi-dash-square"></i></button>
|
||||
<div class="d-flex gap-1">
|
||||
<button class="btn btn-outline-secondary btn-sm" id="expand-all" style="font-size: 0.75rem;">Развернуть</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" id="collapse-all" style="font-size: 0.75rem;">Свернуть</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user