Refactor: Show rename icon on hover instead of click on name

Changed category rename behavior - clicking name now expands/collapses,
pencil icon appears on hover for renaming.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 01:00:51 +03:00
parent 6517643e0d
commit 03990292a5
3 changed files with 33 additions and 24 deletions

View File

@@ -118,16 +118,21 @@
.catalog-list .catalog-item .card-body .mt-1 {
margin-top: 0 !important;
}
/* Inline-редактирование названий категорий */
.category-name-editable {
cursor: text;
/* Кнопка переименования категории */
.category-rename-btn {
opacity: 0;
cursor: pointer;
color: #6c757d;
font-size: 0.75rem;
padding: 2px 4px;
margin: -2px -4px;
border-radius: 3px;
transition: background-color 0.15s;
transition: opacity 0.2s, color 0.15s;
}
.category-name-editable:hover {
background-color: #e7f1ff;
.category-header:hover .category-rename-btn {
opacity: 0.5;
}
.category-rename-btn:hover {
opacity: 1 !important;
color: #0d6efd;
}
</style>
{% endblock %}

View File

@@ -10,12 +10,13 @@
<i class="bi bi-dot text-muted"></i>
{% endif %}
<i class="bi bi-folder{% if node.children %}-fill text-warning{% else %}2 text-secondary{% endif %}"></i>
<span class="flex-grow-1 category-name-editable" data-category-id="{{ node.category.pk }}">{{ node.category.name }}</span>
<span class="flex-grow-1 category-name" data-category-id="{{ node.category.pk }}">{{ node.category.name }}</span>
{% with products_count=node.category.products.count kits_count=node.category.kits.count %}
{% if products_count or kits_count %}
<span class="badge bg-light text-dark border" style="font-size: 0.7rem;">{{ products_count|add:kits_count }}</span>
{% endif %}
{% endwith %}
<i class="bi bi-pencil category-rename-btn" data-category-id="{{ node.category.pk }}" title="Переименовать"></i>
</div>
{% if node.children %}