Newer
Older
simple-opds / src / main / resources / templates / authors.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout}">
<head>
    <title>Авторы - SOPDS</title>
    <style>
        .alphabet-nav {
            background: #f8f9fa;
            border-radius: 5px;
            padding: 10px;
            margin-bottom: 20px;
        }
        .alphabet-nav a {
            display: inline-block;
            margin: 0 2px;
            padding: 5px 10px;
            text-decoration: none;
        }
        .alphabet-nav a.active {
            background: #007bff;
            color: white;
            border-radius: 3px;
        }
    </style>
</head>
<body>
<div layout:fragment="content">
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">Авторы</h1>
        <div class="btn-toolbar mb-2 mb-md-0">
            <div class="btn-group me-2">
                <button type="button" class="btn btn-sm btn-outline-secondary" disabled>
                    Всего: <span th:text="${authors.totalElements}">0</span>
                </button>
            </div>
        </div>
    </div>

    <!-- Алфавитная навигация -->
    <div class="alphabet-nav text-center">
<!--        <a th:href="@{/authors}" th:classappend="${!letter} ? 'active'">Все</a>-->
        <a th:each="l : ${#strings.arraySplit('А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ы,Ь,Э,Ю,Я,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z', ',')}"
           th:href="@{/authors(letter=${l})}"
           th:classappend="${letter == l} ? 'active'"
           th:text="${l}">A</a>
    </div>

    <!-- Список авторов -->
    <div class="author-list">
        <div th:each="author : ${authors.content}" class="mb-2">
            <a th:href="@{/books/author/{id}(id=${author.id})}" class="text-decoration-none">
                <i class="bi bi-person"></i>
                <span th:text="${author.fullName}">Имя автора</span>
                <small class="text-muted" th:if="${author.bookCount}" th:text="'(' + ${author.bookCount} + ')'">(0)</small>
            </a>
        </div>
    </div>

    <!-- Пагинация -->
    <nav th:if="${authors.totalPages > 1}" aria-label="Page navigation" class="mt-4">
        <ul class="pagination justify-content-center">
            <li class="page-item" th:classappend="${authors.first} ? 'disabled'">
                <a class="page-link" th:href="@{/authors(letter=${letter}, page=0)}">Первая</a>
            </li>
            <li class="page-item" th:classappend="${authors.first} ? 'disabled'">
                <a class="page-link" th:href="@{/authors(letter=${letter}, page=${authors.number - 1})}">Назад</a>
            </li>

            <li th:each="page : ${#numbers.sequence(0, authors.totalPages - 1)}"
                class="page-item"
                th:classappend="${page == authors.number} ? 'active'">
                <a class="page-link" th:href="@{/authors(letter=${letter}, page=${page})}" th:text="${page + 1}">1</a>
            </li>

            <li class="page-item" th:classappend="${authors.last} ? 'disabled'">
                <a class="page-link" th:href="@{/authors(letter=${letter}, page=${authors.number + 1})}">Вперед</a>
            </li>
            <li class="page-item" th:classappend="${authors.last} ? 'disabled'">
                <a class="page-link" th:href="@{/authors(letter=${letter}, page=${authors.totalPages - 1})}">Последняя</a>
            </li>
        </ul>
    </nav>

    <div th:if="${authors == null or authors.content.empty}" class="text-center py-5">
        <i class="bi bi-people" style="font-size: 4rem; color: #6c757d;"></i>
        <h4 class="mt-3">Авторы не найдены</h4>
        <p class="text-muted">Попробуйте выбрать другую букву</p>
    </div>
</div>
</body>
</html>