Newer
Older
simple-opds / src / main / resources / templates / books.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="ru">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="shortcut icon" type="image/icon" th:href="@{/images/favicon.ico}"/>
    <title th:text="${appTitle + (breadcrumbs != null && !breadcrumbs.empty ? ' / ' + breadcrumbs[0] : '')}">SOPDS</title>

    <!-- Foundation CSS -->
    <link rel="stylesheet" type="text/css" th:href="@{/css/foundation.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/sopds.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/foundation-icons.css}">
</head>
<body>
<div class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/top :: top"></div>
    </div>
</div>

<div class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/logo :: logo"></div>
    </div>
</div>

<div class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/menu :: menu"></div>
    </div>
</div>

<div class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/breadcrumbs :: breadcrumbs"></div>
    </div>
</div>

<div th:if="${systemMessage != null}" class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/messages :: messages"></div>
    </div>
</div>

<div th:fragment="body">
    <script th:inline="javascript">
        function del_bsbook(b_id, b_t) {
            $('#DeleteBook_btnYes').attr("href",
                /*[[@{/web/bsdel}]]*/ + '?book=' + b_id);
            $('#DeleteBook_image').attr("src",
                /*[[@{/opds/covertmpl}]]*/ + b_id + '/');
            $('#DeleteBook_title').text(b_t);
            $('#DeleteBookModal').foundation('open');
        }
    </script>

    <!-- Модальное окно удаления книги -->
    <div id="DeleteBookModal" class="reveal tiny text-center" data-reveal>
        <h5 th:text="#{bookshelf.delete.confirm}">Confirm the deletion of the book to your bookshelf.</h5>
        <table>
            <tr>
                <td width="100px" style="padding:0rem 0rem;">
                    <img src="" id="DeleteBook_image" style="max-height: 100px; max-width: 100px">
                </td>
                <td style="font-size:100%; padding:3px">
                    <p id="DeleteBook_title"></p>
                </td>
            </tr>
        </table>
        <p class="text-center">
            <a href="#" class="secondary button" id="DeleteBook_btnYes" th:text="#{action.delete}">Delete</a>
            &nbsp;&nbsp;&nbsp;
            <a class="close button" data-close th:text="#{action.cancel}">Cancel</a>
        </p>
        <button class="close-button" data-close aria-label="Close modal" type="button">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>

    <!-- Кнопка очистки полки -->
    <div th:if="${isbookshelf}">
        <div id="ConfirmModal" class="reveal tiny text-center" data-reveal>
            <h5 th:text="#{bookshelf.clear.confirm}">Confirm to clear your bookshelf.</h5>
            <p></p>
            <p class="text-center">
                <a th:href="@{/web/bsclear}" class="secondary button" th:text="#{action.clear}">Clear</a>
                &nbsp;&nbsp;&nbsp;
                <a class="close button" data-close th:text="#{action.cancel}">Cancel</a>
            </p>
            <button class="close-button" data-close aria-label="Close modal" type="button">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <a class="alert button small" data-open="ConfirmModal" th:text="#{bookshelf.clear}">Clear bookshelf</a>
    </div>

    <!-- Список книг -->
    <div th:each="b : ${books}">
        <div class="large-12 column">
            <b th:text="${b.title}">Book Title</b>
            <i style="font-size:80%;" th:text="#{download}">Download:</i>
            <i><a th:href="@{/opds/download/{id}/{type}(id=${b.id}, type=0)}">
                <span class="label small" th:text="${b.format}">format</span>
            </a></i>&nbsp;

            <i th:if="${!#lists.contains(nozip, b.format)}">
                <a th:href="@{/opds/download/{id}/{type}(id=${b.id}, type=1)}">
                    <span class="label small" th:text="${b.format + '+zip'}">format+zip</span>
                </a>
            </i>&nbsp;

            <i th:if="${b.format == 'fb2' and fb2toepub}">
                <a th:href="@{/opds/convert/{id}/{format}(id=${b.id}, format='epub')}">
                    <span class="label small">epub</span>
                </a>
            </i>&nbsp;

            <i th:if="${b.format == 'fb2' and fb2tomobi}">
                <a th:href="@{/opds/convert/{id}/{format}(id=${b.id}, format='mobi')}">
                    <span class="label small">mobi</span>
                </a>
            </i>&nbsp;

            <span th:if="${isbookshelf}">
                &nbsp;&nbsp;
                <i><a href="#" th:onclick="'del_bsbook(' + ${b.id} + ',\'' + ${b.title} + '\');'">
                    <span class="secondary label small" th:text="#{bookshelf.delete}">Delete from bookshelf</span>
                </a></i>
            </span>
        </div>

        <div class="large-12 column">
            <table>
                <tr>
                    <td width="100px" style="padding:0rem 0rem;">
                        <img th:src="@{/opds/thumb/{id}(id=${b.id})}" type="image/jpeg" width="80px">
                    </td>
                    <td style="font-size:80%; padding:1rem 1rem;">
                        <b th:text="#{book.title}">Book title:</b> <span th:text="${b.title}">title</span><br>

                        <span th:if="${#lists.size(b.authors) > 0}">
                            <b th:text="#{authors}">Authors:</b>
                            <th:block th:each="a, iter : ${b.authors}">
                                <a th:href="@{/web/searchbooks(searchtype='a', searchterms=${a.id})}"
                                   th:text="${a.fullName}">Author</a>
                                <span th:if="${!iter.last}">,</span>
                            </th:block><br>
                        </span>

                        <span th:if="${#lists.size(b.genres) > 0}">
                            <b th:text="#{genres}">Genres:</b>
                            <th:block th:each="g, iter : ${b.genres}">
                                <a th:href="@{/web/searchbooks(searchtype='g', searchterms=${g.id})}"
                                   th:text="${g.subsection}">Genre</a>
                                <span th:if="${!iter.last}">,</span>
                            </th:block><br>
                        </span>

                        <span th:if="${#lists.size(b.series) > 0}">
                            <b th:text="#{series}">Series:</b>
                            <th:block th:each="s, iter : ${b.series}">
                                <a th:href="@{/web/searchbooks(searchtype='s', searchterms=${s.id})}"
                                   th:text="${s.ser}">Series</a>
                                <span th:if="${!iter.last}">,</span>
                            </th:block><br>
                            <b th:text="#{series.number}">No in Series:</b>
                            <th:block th:each="sn, iter : ${b.serNo}">
                                <span th:text="${sn.serNo}">1</span>
                                <span th:if="${!iter.last}">,</span>
                            </th:block><br>
                        </span>

                        <b th:text="#{file}">File:</b> <span th:text="${b.path + '/' + b.filename}">path</span><br>
                        <b th:text="#{file.size}">File size:</b> <span th:text="${b.filesize + 'Кб.'}">size</span><br>
                        <b th:text="#{changes.date}">Changes date:</b> <span th:text="${b.docdate}">date</span><br>

                        <span th:if="${b.doubles > 0}">
                            <b th:text="#{doubles}">Doubles for book:</b>
                            <a th:href="@{/web/searchbooks(searchtype='d', searchterms=${b.id})}">
                                <span th:text="${b.title + ' (' + b.doubles + 'шт.)'}">title (count)</span>
                            </a><br>
                        </span>

                        <span th:if="${b.readtime}">
                            <b th:text="#{read.date}">Read date:</b>
                            <span class="label small" th:text="${b.readtime[0].readtime}">read date</span><br>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <p style="font-size:80%;" th:text="${b.annotation}">Annotation</p>
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <!-- Пагинация -->
    <div th:if="${paginator.numPages > 1}">
        <ul class="pagination" role="navigation" aria-label="Pagination">
            <li class="pagination-previous" th:classappend="${not paginator.hasPrevious} ? 'disabled' : ''">
                <a th:if="${paginator.hasPrevious}"
                   th:href="@{/web/searchbooks(searchtype=${searchtype}, searchterms=${searchterms}, page=${paginator.previousPageNumber})}"
                   aria-label="Previous page" th:text="#{pagination.previous}">Previous page</a>
                <span th:unless="${paginator.hasPrevious}" th:text="#{pagination.previous}">Previous page</span>
            </li>

            <th:block th:each="pn : ${paginator.pageRange}">
                <li th:if="${paginator.number == pn}" class="current" th:text="${pn}">1</li>
                <li th:unless="${paginator.number == pn}">
                    <a th:href="@{/web/searchbooks(searchtype=${searchtype}, searchterms=${searchterms}, page=${pn})}"
                       aria-label="Page ${pn}" th:text="${pn}">1</a>
                </li>
            </th:block>

            <li class="pagination-next" th:classappend="${not paginator.hasNext} ? 'disabled' : ''">
                <a th:if="${paginator.hasNext}"
                   th:href="@{/web/searchbooks(searchtype=${searchtype}, searchterms=${searchterms}, page=${paginator.nextPageNumber})}"
                   aria-label="Next page" th:text="#{pagination.next}">Next page</a>
                <span th:unless="${paginator.hasNext}" th:text="#{pagination.next}">Next page</span>
            </li>
        </ul>
    </div>
</div>

<div class="row">
    <div class="large-12 column">
        <div th:replace="/fragments/footer :: footer"></div>
    </div>
</div>

<script th:src="@{/js/vendor/jquery.js}"></script>
<script th:src="@{/js/vendor/foundation.min.js}"></script>


<script>
    $(document).foundation();
</script>
</body>
</html>