Мануал: Как поменять место кнопки "Панель управления"

Добро пожаловать!

Зарегистрировавшись у нас, вы сможете обсуждать, делиться и отправлять личные сообщения другим участникам нашего сообщества.

Зарегистрироваться!
Пользователь
Регистрация
30 Ноя 2025
Сообщения
47
ИНСТРУКЦИЯ:

1. Создайте расширение шаблона для PAGE_CONTAINER через Админку → Внешний вид → Шаблоны
2. Добавьте код в конец шаблона
3. Настройте стили под ваш дизайн
4. Проверьте разрешения пользователей

Код:
<div class="custom-control-panel" style="position: fixed; left: 20px; bottom: 20px; z-index: 9999;">
    <button class="button button--icon" 
            style="background: var(--xf-palette-accent1); color: white; border-radius: 50%; width: 50px; height: 50px;"
            data-xf-click="custom-control-panel">
        <i class="fa fa-cog" style="font-size: 24px;"></i>
    </button>
    
    <div class="custom-control-menu" 
         style="display: none; position: absolute; bottom: 60px; left: 0; background: white; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); min-width: 200px;">
        <div class="menu-header" style="padding: 15px; border-bottom: 1px solid #eee;">
            <strong>Панель управления</strong>
        </div>
        
        <xf:if is="$xf.visitor.is_moderator">
            <a href="{{ link('forums') }}?moderator" class="menu-link" style="display: block; padding: 12px 15px; text-decoration: none; color: #333; border-bottom: 1px solid #eee;">
                Модератор
            </a>
        </xf:if>
        
        <xf:if is="$xf.visitor.is_admin">
            <a href="https://ваш.форум/admin.php" class="menu-link" style="display: block; padding: 12px 15px; text-decoration: none; color: #333;">
                Вход в ПУ
            </a>
        </xf:if>
        
        <xf:if is="!$xf.visitor.is_admin AND !$xf.visitor.is_moderator">
            <div class="menu-link" style="padding: 12px 15px; color: #999; text-align: center;">
                Нет доступа
            </div>
        </xf:if>
    </div>
</div>

<script>
document.addEventListener('click', function(e) {
    const menu = document.querySelector('.custom-control-menu');
    
    if (e.target.closest('[data-xf-click="custom-control-panel"]')) {
        menu.style.display = menu.style.display === 'block' ? 'none' : 'block';
        e.preventDefault();
    } else if (!e.target.closest('.custom-control-menu') && !e.target.closest('[data-xf-click="custom-control-panel"]')) {
        menu.style.display = 'none';
    }
});
</script>

<style>
.custom-control-menu .menu-link:hover {
    background: #f5f5f5;
}
</style>

ЗАМЕНИТЕ https://ваш. форум на ссылку вашего форума "admin.php" НЕ ТРОГАЙТЕ
 
Последнее редактирование:
Сверху