Move breadcrumbs examples to create_breadcrumbs()

This commit is contained in:
SvyatoslavArtymovych 2023-05-02 10:26:33 +03:00
parent f852a421a3
commit 7def9c6cbc
2 changed files with 12 additions and 9 deletions

View File

@ -11,6 +11,18 @@ def create_breadcrumbs(
section_id: int = 0,
interpretation_id: int = 0,
) -> list[s.BreadCrumb]:
"""
How breadcrumbs look like:
Book List -> Book Name -> Top Level Collection -> SubCollection -> Section -> Interpretation
- If i am not owner of a book
John's books -> Book Name -> Top Level Collection -> SubCollection -> Section -> Interpretation
- If i am owner
My Books -> Book Title -> Part I -> Chapter X -> Paragraph 1.7 -> By John
"""
crumples: list[s.BreadCrumb] = []
book: m.Book = db.session.get(m.Book, book_id)
if current_user.is_authenticated and book.user_id == current_user.id:

View File

@ -19,12 +19,3 @@ class BreadCrumb(BaseModel):
label: str
url: str
type: BreadCrumbType
# How breadcrumbs must look like
# Book List > Book Name > Top Level Collection > SubCollection > Section > Interpretation
# if im not owner of a book
# John's books > Book Name > Top Level Collection > SubCollection > Section > Interpretation
# if i owner
# My Books > Book Title > Part I > Chapter X > Paragraph 1.7 > By John