mirror of
https://github.com/EDeev/web-dev.git
synced 2026-06-17 05:21:01 +03:00
33 lines
1.2 KiB
HTML
33 lines
1.2 KiB
HTML
{% extends 'base.html' %}
|
|
{% from 'macros.html' import book_form_fields %}
|
|
{% block title %}{% if is_edit %}Редактирование книги{% else %}Добавление книги{% endif %} — Электронная библиотека{% endblock %}
|
|
|
|
{% block content %}
|
|
<h2 class="mb-4">{% if is_edit %}Редактирование книги{% else %}Добавление книги{% endif %}</h2>
|
|
|
|
<form method="post" enctype="multipart/form-data">
|
|
{{ book_form_fields(book, genres, selected_genres, is_edit, current_cover) }}
|
|
|
|
<div class="d-flex gap-2 mt-3">
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="bi bi-save"></i> Сохранить
|
|
</button>
|
|
<a href="{{ url_for('book_view', book_id=book_id) if is_edit else url_for('index') }}"
|
|
class="btn btn-outline-secondary">Отмена</a>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
const easyMDE = new EasyMDE({
|
|
element: document.getElementById('description-editor'),
|
|
spellChecker: false,
|
|
autosave: { enabled: false }
|
|
});
|
|
|
|
document.querySelector('form').addEventListener('submit', function() {
|
|
easyMDE.codemirror.save();
|
|
});
|
|
</script>
|
|
{% endblock %}
|