diff --git a/djaif/book/templates/admin/book_change_form.html b/djaif/book/templates/admin/book_change_form.html index ba95be9..8e9a106 100644 --- a/djaif/book/templates/admin/book_change_form.html +++ b/djaif/book/templates/admin/book_change_form.html @@ -1,7 +1,7 @@ {% extends "admin/change_form.html" %} {% load i18n admin_urls %} {% block after_related_objects %} - - - + + + {% endblock %} diff --git a/djaif/book/templates/book.html b/djaif/book/templates/book.html deleted file mode 100644 index efa40e2..0000000 --- a/djaif/book/templates/book.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {{ book.title }} - - -

{{ book.title }}

- - - diff --git a/djaif/book/templates/book_index.html b/djaif/book/templates/books.html similarity index 51% rename from djaif/book/templates/book_index.html rename to djaif/book/templates/books.html index 11df404..af17145 100644 --- a/djaif/book/templates/book_index.html +++ b/djaif/book/templates/books.html @@ -8,12 +8,12 @@ diff --git a/djaif/book/templates/default.html b/djaif/book/templates/default.html new file mode 100644 index 0000000..c76b235 --- /dev/null +++ b/djaif/book/templates/default.html @@ -0,0 +1,15 @@ + + + + + {% block title %}{% endblock %} + + + + + {% block body %} + {% endblock %} + + diff --git a/djaif/book/templates/note.html b/djaif/book/templates/note.html index eef7051..eb81d3c 100644 --- a/djaif/book/templates/note.html +++ b/djaif/book/templates/note.html @@ -1,45 +1,38 @@ - - - - - {{ page.book.title }}: {{ page.title }} - - -

- {{ page.title }}: Заметка -

+{% extends "default.html" %} +{% block title %}{{ page.book.title }}: {{ page.title }}{% endblock %} +{% block body %} +
+

{{ page.book.title }} ({{ page.title }}): Заметка

{% csrf_token %} - - - - - + +
- - +
+{% endblock %} diff --git a/djaif/book/templates/page.html b/djaif/book/templates/page.html index 757a175..94a8818 100644 --- a/djaif/book/templates/page.html +++ b/djaif/book/templates/page.html @@ -1,100 +1,97 @@ - - - - - {{ page.book.title }}: {{ page.title }} - - - - -
-
+{% extends "default.html" %} +{% block title %}{{ page.book.title }}: {{ page.title }}{% endblock %} +{% block body %} +
+
+

{{ page.title }}

{{ page.body }} {% if page_items %} -

Вы видите

- +

Вы видите

+ {% endif %} {% if dropped_items %} -

Брошено вами ранее

- +

Брошено вами ранее

+ {% endif %}

Куда податься?

    {% for link, passable in links %} -
  • - {% if passable %} - - {{ link.name }} - - {% else %} - {{ link.name }} - {% endif %} -
  • +
  • + {% if passable %} + + {{ link.name }} + + {% else %} + {{ link.name }} + {% endif %} +
  • {% endfor %}
{% if progress.items.all %} -

Инвентарь

- +

Инвентарь

+ {% endif %}
Сохранения
- - - +
+{% endblock %} diff --git a/djaif/book/templates/saves.html b/djaif/book/templates/saves.html index 278cb25..0e0fd50 100644 --- a/djaif/book/templates/saves.html +++ b/djaif/book/templates/saves.html @@ -1,28 +1,18 @@ - - - - - {{ book.title }}: Сохранения - - -

- {{ book.title }} -

-

- {{ page.title }} -

- [Продолжить игру] -
- [Новое сохранение] +{% extends "default.html" %} +{% block title %}{{ book.title }}: Сохранения{% endblock %} +{% block body %} +
+

{{ page.book.title }} ({{ page.title }}): Сохранения

+ [Новое сохранение] - - +
+{% endblock %} diff --git a/djaif/book/views.py b/djaif/book/views.py index 0090e7a..595faef 100644 --- a/djaif/book/views.py +++ b/djaif/book/views.py @@ -33,7 +33,7 @@ def inner(request, book_id, **kwargs): def view_books(request): return render( request, - 'book_index.html', + 'books.html', context={'books': models.Book.objects.all()}, ) @@ -85,7 +85,6 @@ def view_book(request, book_id): 'page': progress.book_page, 'progress': progress, 'links': links, - 'notesets': notesets, 'page_items': progress.book_page.items.exclude( id__in=progress.items.only('id'), ).exclude( @@ -96,6 +95,7 @@ def view_book(request, book_id): 'dropped_items': progress.droppeditem_set.filter( book_page=progress.book_page, ).all(), + 'notesets': notesets, }, ) @@ -164,7 +164,6 @@ def view_saves(request, progress, book_id): request, 'saves.html', context={ - 'book': progress.book, 'page': progress.book_page, 'saves': saves, }, @@ -195,10 +194,7 @@ def view_book_map(request, book_id): @on_progress def add_note(request, progress, book_id): - if 'pin' in request.POST: - page = progress.book_page - else: - page = None + page = progress.book_page if 'pin' in request.POST else None models.Note.objects.create( progress=progress, text=request.POST['text'], diff --git a/static/page.css b/static/page.css deleted file mode 100644 index c91453b..0000000 --- a/static/page.css +++ /dev/null @@ -1,57 +0,0 @@ -body { - padding: 0; - margin: 0; - height: 100vh; - display: flex; - flex-direction: column; -} - -.main { - flex: 1 1; - display: flex; -} - -.content { - flex: 1 1; - padding: 1em; - font-size: 150%; -} - -.new-note { - display: flex; - flex-direction: column; -} - -.sidebar { - padding: 0.2em; - background-color: lightgray; - font-size: 120%; -} - -.noteset { - padding: 0; - margin: 0; -} - -.noteset > li { - list-style: none; - border-bottom: 1pt black solid; -} - -.noteset > li > pre { - margin: 0; - padding: 0.5em; - font-family: Serif; -} - -.noteset-other { - background-color: white; -} - -.noteset-page { - background-color: greenyellow; -} - -.noteset-pinned { - background-color: yellow; -} diff --git a/static/styles.css b/static/styles.css new file mode 100644 index 0000000..2c2d9ba --- /dev/null +++ b/static/styles.css @@ -0,0 +1,79 @@ +body { + padding: 0; + margin: 0; +} + +/* Page */ + +.page { + height: 100vh; + display: flex; + flex-direction: column; +} + +.page h1 { + margin-top: 0; +} + +.page-split { + flex: 1 1; + display: flex; + flex-direction: row; +} + +.page-content { + flex: 1 1; + padding: 1em; +} + +.page-sidebar { + padding: 0.2em; + background-color: lightgray; +} + +.page-sidebar > h3 { + margin-top: 0; + margin-bottom: 0.5em; +} + +.page-sidebar > .new-note { + display: flex; + flex-direction: column; + margin-bottom: 0.5em; + font-size: smaller; +} + +.page-sidebar > .noteset { + padding: 0; + margin: 0; +} + +.page-sidebar > .noteset > li { + list-style: none; + border-bottom: 1pt black solid; +} + +.page-sidebar > .noteset > li > pre { + margin: 0; + padding: 0.5em; + font-family: Serif; +} + +.page-sidebar > .noteset-other { + background-color: white; +} + +.page-sidebar > .noteset-page { + background-color: greenyellow; +} + +.page-sidebar > .noteset-pinned { + background-color: yellow; +} + +/* Single form */ + +.single-column { + margin: 1em auto; + max-width: 800px; +}