193 lines
9.7 KiB
HTML
193 lines
9.7 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>
|
|
<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 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 book in items %}
|
|
|
|
<li class="result-item clearfix">
|
|
<a href="{% url 'books:retrieve' book.id %}">
|
|
<img src="{{ book.cover.url }}" alt="" class="result-book-cover">
|
|
</a>
|
|
<div class="result-info">
|
|
|
|
<a href="{% url 'books:retrieve' book.id %}" class="result-item-title">
|
|
{% if request.GET.keywords %}
|
|
{{ book.title | highlight:request.GET.keywords }}
|
|
{% else %}
|
|
{{ book.title }}
|
|
{% endif %}
|
|
</a>
|
|
{% if book.rating %}
|
|
|
|
<div class="rating-star" data-rating-score="{{ book.rating | floatformat:"0" }}"></div>
|
|
<span class="rating-score">
|
|
{{ book.rating }}
|
|
</span>
|
|
{% else %}
|
|
<span class="rating-empty"> {% trans '暂无评分' %}</span>
|
|
{% endif %}
|
|
<span class="result-book-info">
|
|
{% if book.pub_year %}
|
|
{{ book.pub_year }}{% trans '年' %} /
|
|
{% if book.pub_month %}
|
|
{{book.pub_month }}{% trans '月' %} /
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if book.author %}
|
|
{% trans '作者' %}
|
|
{% for author in book.author %}
|
|
{{ author }}{% if not forloop.last %},{% endif %}
|
|
{% endfor %}/
|
|
{% endif %}
|
|
|
|
{% if book.translator %}
|
|
{% trans '译者' %}
|
|
{% for translator in book.translator %}
|
|
{{ translator }}{% if not forloop.last %},{% endif %}
|
|
{% endfor %}/
|
|
{% endif %}
|
|
|
|
{% if book.orig_title %}
|
|
{% trans '原名' %}
|
|
{{ book.orig_title }}
|
|
{% endif %}
|
|
</span>
|
|
<p class="result-item-brief">
|
|
{{ book.brief | truncate:170 }}
|
|
</p>
|
|
</div>
|
|
</li>
|
|
{% empty %}
|
|
{% trans '无结果' %}
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
<div class="pagination" >
|
|
|
|
<a
|
|
{% if items.has_previous %}
|
|
href="?page=1&keywords={% if request.GET.keywords %}{{ request.GET.keywords }}{% endif %}"
|
|
{%else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not items.has_previous %}disabled{% endif %} class="button button-clear">{% trans "首页" %}</button>
|
|
</a>
|
|
|
|
<a
|
|
{% if items.has_previous %}
|
|
href="?page={{ items.previous_page_number }}&keywords={% if request.GET.keywords %}{{ request.GET.keywords }}{% endif %}"
|
|
{%else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not items.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 items.has_next %}
|
|
href="?page={{ items.next_page_number }}&keywords={% if request.GET.keywords %}{{ request.GET.keywords }}{% endif %}"
|
|
{% else %}
|
|
disabled
|
|
{% endif %}
|
|
>
|
|
<button {% if not items.has_next %}disabled{% endif %} class="button button-clear">{% trans "下一页" %}</button>
|
|
</a>
|
|
|
|
<a
|
|
{% if items.has_next %}
|
|
href="?page={{ items.paginator.num_pages }}&keywords={% if request.GET.keywords %}{{ request.GET.keywords }}{% endif %}"
|
|
{%else %}
|
|
disabled
|
|
{% endif %}>
|
|
<button {% if not items.has_next %}disabled{% endif %} class="button button-clear">{% trans "末页" %}</button>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="aside">
|
|
<div class="aside-card">
|
|
<div class="add-nav">
|
|
<div>{% trans '没有想要的结果?' %}</div>
|
|
<a href="{% url 'books:create' %}" class="button add-button">{% trans '添加一个条目' %}</a>
|
|
<div>{% trans '或者' %}</div>
|
|
<a href="{% url 'books:scrape' %}{% if request.GET.keywords %}?keywords={{ request.GET.keywords }}{% endif %}" class="button add-button">{% trans '从表瓣剽取数据d(≖ ◡ ≖)✧' %}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<footer class="container">
|
|
<a href="https://donotban.com/@whitiewhite">去长毛象向作者提意见</a>
|
|
<a href="" id="githubLink">Github</a>
|
|
</footer>
|
|
</div>
|
|
|
|
|
|
{% comment %}
|
|
<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>
|
|
{% endcomment %}
|
|
|
|
<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>
|