234 lines
11 KiB
HTML
234 lines
11 KiB
HTML
{% load static %}
|
|
{% load i18n %}
|
|
{% load admin_url %}
|
|
{% load mastodon %}
|
|
{% load oauth_token %}
|
|
{% load truncate %}
|
|
{% load highlight %}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% trans 'Boofilsic - 书' %}</title>
|
|
<script src="https://cdn.staticfile.org/jquery/3.5.0/jquery.min.js"></script>
|
|
<script src="{% static 'lib/js/rating-star.js' %}"></script>
|
|
<script src="{% static 'js/rating-star-readonly.js' %}"></script>
|
|
<script src="{% static 'js/mastodon.js' %}"></script>
|
|
<script src="{% static 'js/home.js' %}"></script>
|
|
<link rel="stylesheet" href="{% static 'css/boofilsic_browse.css' %}">
|
|
<link rel="stylesheet" href="{% static 'lib/css/rating-star.css' %}">
|
|
<link rel="stylesheet" href="{% static 'lib/css/milligram.css' %}">
|
|
</head>
|
|
|
|
<body>
|
|
<div id="page-wrapper">
|
|
<div id="content-wrapper">
|
|
<section id="navbar" class="navbar">
|
|
<div class="container">
|
|
<nav class="clearfix">
|
|
<a href="{% url 'common:home' %}">
|
|
<img src="{% static 'img/logo.svg' %}" alt="" class="logo">
|
|
</a>
|
|
<input type="search" class="search-box" name="keywords"
|
|
value="{% if request.GET.keywords %}{{ request.GET.keywords }}{% endif %}" id="searchInput" required="true" placeholder="{% trans '搜索书影音,多个关键字以空格分割' %}">
|
|
<a class="nav-link" id="logoutLink" href="{% url 'users:logout' %}">{% trans '登出' %}</a>
|
|
<a class="nav-link" href="{% url 'common:home' %}">{% trans '主页' %}</a>
|
|
{% if request.user.is_staff %}
|
|
<a class="nav-link" href="{% admin_url %}">{% trans '后台' %}</a>
|
|
{% endif %}
|
|
</nav>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="content" class="container">
|
|
<div class="row">
|
|
<div id="main">
|
|
<ul class="result-items">
|
|
|
|
{% for mark in marks %}
|
|
|
|
<li class="result-item clearfix">
|
|
<a href="{% url 'books:retrieve' mark.book.id %}">
|
|
<img src="{{ mark.book.cover.url }}" alt="" class="result-book-cover">
|
|
</a>
|
|
<div class="result-info">
|
|
|
|
<a href="{% url 'books:retrieve' mark.book.id %}" class="result-item-title">
|
|
{{ mark.book.title }}
|
|
</a>
|
|
{% if mark.book.rating %}
|
|
|
|
<div class="rating-star" data-rating-score="{{ mark.book.rating | floatformat:"0" }}"></div>
|
|
<span class="rating-score">
|
|
{{ mark.book.rating }}
|
|
</span>
|
|
{% else %}
|
|
<span class="rating-empty"> {% trans '暂无评分' %}</span>
|
|
{% endif %}
|
|
<span class="result-book-info">
|
|
{% if mark.book.pub_year %}
|
|
{{ mark.book.pub_year }}{% trans '年' %} /
|
|
{% if mark.book.pub_month %}
|
|
{{ mark.book.pub_month }}{% trans '月' %} /
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if mark.book.author %}
|
|
{% trans '作者' %}
|
|
{% for author in mark.book.author %}
|
|
{{ author }}{% if not forloop.last %},{% endif %}
|
|
{% endfor %}/
|
|
{% endif %}
|
|
|
|
{% if mark.book.translator %}
|
|
{% trans '译者' %}
|
|
{% for translator in mark.book.translator %}
|
|
{{ translator }}{% if not forloop.last %},{% endif %}
|
|
{% endfor %}/
|
|
{% endif %}
|
|
|
|
{% if mark.book.orig_title %}
|
|
{% trans '原名' %}
|
|
{{ mark.book.orig_title }}
|
|
{% endif %}
|
|
</span>
|
|
<p class="result-item-brief">
|
|
{{ mark.book.brief | truncate:170 }}
|
|
</p>
|
|
</div>
|
|
</li>
|
|
{% empty %}
|
|
{% trans '无结果' %}
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
<div class="pagination" >
|
|
|
|
<a
|
|
{% if marks.has_previous %}
|
|
href="?page=1"
|
|
{% else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not marks.has_previous %}disabled{% endif %} class="button button-clear">{% trans "首页" %}</button>
|
|
</a>
|
|
|
|
<a
|
|
{% if marks.has_previous %}
|
|
href="?page={{ marks.previous_page_number }}"
|
|
{% else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not marks.has_previous %}disabled{% endif %} class="button button-clear">{% trans "上一页" %}</button>
|
|
</a>
|
|
|
|
<span class="page-index">
|
|
{% trans "第" %}{% if request.GET.page %}{{ request.GET.page }}{% else %}1{% endif %}{% trans "页" %}
|
|
</span>
|
|
|
|
<a
|
|
{% if marks.has_next %}
|
|
href="?page={{ marks.next_page_number }}"
|
|
{% else %}
|
|
disabled
|
|
{% endif %}
|
|
>
|
|
<button {% if not marks.has_next %}disabled{% endif %} class="button button-clear">{% trans "下一页" %}</button>
|
|
</a>
|
|
|
|
<a
|
|
{% if marks.has_next %}
|
|
href="?page={{ marks.paginator.num_pages }}"
|
|
{% else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not marks.has_next %}disabled{% endif %} class="button button-clear">{% trans "末页" %}</button>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="aside">
|
|
<div class="aside-card mast-user" id="userInfoCard">
|
|
<div class="clearfix">
|
|
<img src="" class="info-avatar mast-avatar" alt="{{ user.username }}">
|
|
<a href="{% url 'users:home' user.id %}">
|
|
<h5 class="info-name mast-displayname"></h5>
|
|
</a>
|
|
</div>
|
|
<p class="info-brief mast-brief"></p>
|
|
<!-- <a href="#" class="follow">{% trans '关注TA' %}</a> -->
|
|
|
|
{% if request.user != user %}
|
|
<a href="#" class="report">{% trans '举报用户' %}</a>
|
|
{% endif %}
|
|
|
|
</div>
|
|
<div class="relation-card" id="userRelationCard">
|
|
<h5 class="relation-label">
|
|
{% trans '关注的人' %}
|
|
</h5>
|
|
<a href="{% url 'users:following' user.id %}" class="more-link mast-following-more">{% trans '更多' %}</a>
|
|
<ul class="row mast-following relation-user-list">
|
|
<li class="column column-25 relation-user">
|
|
<img src="" alt="" class="relation-avatar">
|
|
<a class="relation-name"></a>
|
|
</li>
|
|
</ul>
|
|
<h5 class="relation-label">
|
|
{% trans '被他们关注' %}
|
|
</h5>
|
|
<a href="{% url 'users:followers' user.id %}" class="more-link mast-followers-more">{% trans '更多' %}</a>
|
|
<ul class="row mast-followers relation-user-list">
|
|
<li class="column column-25 relation-user">
|
|
<img src="" alt="" class="relation-avatar">
|
|
<a class="relation-name"></a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<footer class="container">
|
|
<a href="">whitiewhite@donotban.com</a>
|
|
<a href="" id="githubLink">Github</a>
|
|
</footer>
|
|
</div>
|
|
|
|
|
|
<div id="oauth2Token" hidden="true">{% oauth_token %}</div>
|
|
<div id="mastodonURI" hidden="true">{% mastodon %}</div>
|
|
<!--current user mastodon id-->
|
|
<div id="userMastodonID" hidden="true">{{ user.mastodon_id }}</div>
|
|
<div id="userPageURL" hidden="true">{% url 'users:home' 0 %}</div>
|
|
<div class="spinner" id="spinner" hidden>
|
|
<div class="lds-spinner">
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
<div></div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$("#searchInput").on('keyup', function (e) {
|
|
if (e.keyCode === 13) {
|
|
let keywords = $(this).val();
|
|
if (keywords)
|
|
location.href = "{% url 'common:search' %}" + "?keywords=" + keywords;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
|
|
</html>
|