Merge branch 'develop' into kostia/feature/quicksearch

This commit is contained in:
Kostiantyn Stoliarskyi 2023-05-25 17:43:04 +03:00
commit 192c088a2c
8 changed files with 52 additions and 56 deletions

View File

@ -39,7 +39,7 @@ def create_breadcrumbs(
crumples += [
s.BreadCrumb(
type=s.BreadCrumbType.AuthorBookList,
url="#",
url="",
label=book.owner.username + "'s books",
)
]
@ -60,11 +60,7 @@ def create_breadcrumbs(
crumples += [
s.BreadCrumb(
type=s.BreadCrumbType.Collection,
url=url_for(
"book.sub_collection_view",
book_id=book_id,
collection_id=collection_id,
),
url="",
label=collection.label,
)
]
@ -72,12 +68,7 @@ def create_breadcrumbs(
crumples += [
s.BreadCrumb(
type=s.BreadCrumbType.Section,
url=url_for(
"book.section_view",
book_id=book_id,
collection_id=collection_path[0],
sub_collection_id=collection_path[-1],
),
url="",
label=collection.label,
)
]

View File

@ -1,7 +1,10 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms import StringField, SubmitField, ValidationError
from wtforms.validators import DataRequired
from app.controllers import clean_html
from app.logger import log
class BaseInterpretationForm(FlaskForm):
about = StringField("About")
@ -12,6 +15,14 @@ class CreateInterpretationForm(BaseInterpretationForm):
section_id = StringField("Interpretation ID", [DataRequired()])
submit = SubmitField("Create")
def validate_text(self, field):
text = clean_html(field.data)
text = text.replace(" ", "")
text = text.strip()
if len(text) < 1:
log(log.WARNING, "Can't submit empty interpretation")
raise ValidationError("You can't create interpretation with no text")
class EditInterpretationForm(BaseInterpretationForm):
interpretation_id = StringField("Interpretation ID", [DataRequired()])

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@
<div class="grid gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="label" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white" >Label</label >
<input type="text" name="label" id="label" class="shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-600 focus:border-blue-600 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Collection label" required />
<input type="text" name="label" id="label" class="shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-600 focus:border-blue-600 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Section label" required />
</div>
</div>
</div>

View File

@ -2,22 +2,15 @@
{% extends 'base.html' %}
{% if current_user.is_authenticated %}
{% include 'book/delete_section_modal.html' %}
{% include 'book/edit_section_modal.html' %}
{% include 'book/approve_interpretation_modal.html' %}
<!-- prettier-ignore -->
{% set show_delete_section = True %}
<!-- prettier-ignore -->
{% set show_edit_section = True %}
{% block right_sidebar %}
{% include 'book/right_sidebar.html' %}
{% endblock %}
{% endif %}
{% block content %}
{% include 'book/breadcrumbs_navigation.html'%}
<div class="overflow-x-auto shadow-md sm:rounded-lg md:mr-64">
<div class="overflow-x-auto shadow-md sm:rounded-lg">
<!-- prettier-ignore -->
<div class="fixed z-30 w-full top-44 pt-6 bg-white border-b border-gray-200 dark:bg-gray-800 dark:border-gray-700">
<!-- prettier-ignore -->

View File

@ -4,21 +4,16 @@
{% if current_user.is_authenticated %}
{% include 'book/delete_interpretation_modal.html' %}
{% include 'book/delete_comment_modal.html' %}
{% include 'book/edit_comment_modal.html' %}
{% include 'book/edit_interpretation_modal.html' %}
{% set show_edit_interpretation = True %}
{% set show_delete_interpretation = True %}
{% block right_sidebar %}
{% include 'book/right_sidebar.html' %}
{% endblock %}
{% endif %}
{% block content %}
{% include 'book/breadcrumbs_navigation.html'%}
<div class="shadow-md mt-5 md:mr-64 h-auto overflow-x-hidden">
<div class="shadow-md mt-5 h-auto overflow-x-hidden">
<div class="ql-snow mt-20">
<h1 class="text-l font-extrabold dark:text-white ml-4 truncate">
{{ section.label }}

View File

@ -174,6 +174,7 @@ def favorite_books():
@bp.route("/my_contributions", methods=["GET"])
def my_contributions():
if current_user.is_authenticated:
interpretations = (
db.session.query(
m.Interpretation,
@ -205,3 +206,4 @@ def my_contributions():
),
page=pagination,
)
return render_template("book/my_contributions.html", interpretations=[])

View File

@ -46,6 +46,10 @@ export function addSection() {
`${collectionId}/${subCollectionId}/create_section`,
);
}
if (newActionPath.includes('/0')) {
console.log('ALERT');
return;
}
addSectionForm.setAttribute('action', `${newActionPath}`);
sectionModal.show();