clean done

This commit is contained in:
Kostiantyn Stoliarskyi 2023-05-25 16:51:42 +03:00
parent 33812b83ee
commit c82f90c6fb
5 changed files with 35 additions and 54 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

@ -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,34 +174,36 @@ def favorite_books():
@bp.route("/my_contributions", methods=["GET"])
def my_contributions():
interpretations = (
db.session.query(
m.Interpretation,
)
.filter(
or_(
and_(
m.Interpretation.id == m.Comment.interpretation_id,
m.Comment.user_id == current_user.id,
m.Comment.is_deleted.is_(False),
m.Interpretation.is_deleted.is_(False),
),
and_(
m.Interpretation.user_id == current_user.id,
m.Interpretation.is_deleted.is_(False),
),
if current_user.is_authenticated:
interpretations = (
db.session.query(
m.Interpretation,
)
.filter(
or_(
and_(
m.Interpretation.id == m.Comment.interpretation_id,
m.Comment.user_id == current_user.id,
m.Comment.is_deleted.is_(False),
m.Interpretation.is_deleted.is_(False),
),
and_(
m.Interpretation.user_id == current_user.id,
m.Interpretation.is_deleted.is_(False),
),
)
)
.group_by(m.Interpretation.id)
.order_by(m.Interpretation.created_at.desc())
)
.group_by(m.Interpretation.id)
.order_by(m.Interpretation.created_at.desc())
)
pagination = create_pagination(total=interpretations.count())
pagination = create_pagination(total=interpretations.count())
return render_template(
"book/my_contributions.html",
interpretations=interpretations.paginate(
page=pagination.page, per_page=pagination.per_page
),
page=pagination,
)
return render_template(
"book/my_contributions.html",
interpretations=interpretations.paginate(
page=pagination.page, per_page=pagination.per_page
),
page=pagination,
)
return render_template("book/my_contributions.html", interpretations=[])