Files
infra/stacks/books/app/templates/book.html
T

52 lines
3.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}{{ b.title }} — Книги{% endblock %}
{% block body %}
<h1>{{ b.title or b.orig }}</h1>
<p class="muted">{% if b.author %}{{ b.author }} · {% endif %}{{ b.fmt|upper }}{% if b.pages %} · {{ b.pages }} с.{% endif %}
· <a href="/book/{{ b.id }}/file" target="_blank">оригинал</a>
· <a href="/book/{{ b.id }}/recaps.md">рекапы (.md)</a>
· <a href="/search?book={{ b.id }}">поиск</a></p>
{% if b.note %}<p class="warn">{{ b.note }}</p>{% endif %}
{% if b.status in ('parsing','indexing') %}<p class="warn" id="busy" data-book="{{ b.id }}">Книга обрабатывается… страница обновится сама.</p>{% endif %}
<section class="card">
<div class="row between">
<h2>Главы</h2>
<span><button id="recap-selected" data-book="{{ b.id }}">Рекап выбранных</button>
<label class="small"><input type="checkbox" id="only-missing" checked> только без рекапа</label></span>
</div>
<ol class="toc">
{% for ch in chapters %}
<li class="lvl{{ ch.level }}" data-idx="{{ ch.idx }}">
<input type="checkbox" class="pick" value="{{ ch.idx }}" {% if ch.has_recap %}data-has="1"{% endif %}>
<a href="/book/{{ b.id }}/ch/{{ ch.idx }}">{{ ch.title }}</a>
<span class="small muted">с. {{ ch.p1 }}{% if ch.p2 != ch.p1 %}–{{ ch.p2 }}{% endif %}</span>
{% if ch.read %}<span title="прочитано">✓</span>{% endif %}
{% if ch.has_recap %}<span class="small" title="есть рекап">📝</span>{% endif %}
<span class="small state"></span>
</li>
{% endfor %}
</ol>
</section>
<section class="card">
<h2>Спросить по книге</h2>
<form class="ask" data-book="{{ b.id }}">
<textarea name="q" rows="2" placeholder="Например: чем отличается X от Y по мнению автора?"></textarea>
<div class="row"><button>Спросить</button>
<label class="small"><input type="checkbox" name="web"> проверить по интернету</label></div>
</form>
<div class="answer md"></div>
{% if qa %}<details><summary class="muted">Прошлые вопросы ({{ qa|length }})</summary>
{% for x in qa %}<div class="qa"><b>{{ x.q }}</b><div class="md">{{ x.a }}</div></div>{% endfor %}</details>{% endif %}
</section>
<details class="card"><summary>Название, автор, удаление</summary>
<form action="/book/{{ b.id }}/title" method="post" class="row">
<input name="title" value="{{ b.title or '' }}" placeholder="Название">
<input name="author" value="{{ b.author or '' }}" placeholder="Автор"><button>Сохранить</button></form>
<form action="/book/{{ b.id }}/delete" method="post" class="row">
<input name="confirm" placeholder="впиши «да», чтобы удалить книгу со всеми рекапами"><button class="danger">Удалить</button></form>
</details>
{% endblock %}