diff --git a/app/controllers/breadcrumbs.py b/app/controllers/breadcrumbs.py index 8c05ed8..ce901a1 100644 --- a/app/controllers/breadcrumbs.py +++ b/app/controllers/breadcrumbs.py @@ -10,7 +10,8 @@ def create_collections_breadcrumb( bread_crumbs += [ s.BreadCrumb( type=s.BreadCrumbType.Collection, - url="", + url=url_for("book.collection_view", book_id=collection.book_id) + + f"#collection-{collection.label}", label=collection.label, ) ] diff --git a/app/models/collection.py b/app/models/collection.py index 39c6313..241a03a 100644 --- a/app/models/collection.py +++ b/app/models/collection.py @@ -33,6 +33,10 @@ class Collection(BaseModel): def active_sections(self): return [section for section in self.sections if not section.is_deleted] + @property + def book_id(self): + return self.version.book_id + @property def sub_collections(self): return [ diff --git a/app/templates/book/collection_view.html b/app/templates/book/collection_view.html index dc51e9f..b1e68af 100644 --- a/app/templates/book/collection_view.html +++ b/app/templates/book/collection_view.html @@ -48,13 +48,13 @@ - + + @@ -133,7 +133,7 @@
{% if book.about==None %}About text{% else %}{{book.about}}{% endif %}
{% for collection in book.versions[-1].children_collections if not collection.is_root and not collection.is_deleted %} -#{{collection.label}}
+#{{collection.label}}
{% if not collection.is_leaf and not collection.children %}Collection is empty
{% endif %} diff --git a/app/templates/book/components/sub_collection_preview_content.html b/app/templates/book/components/sub_collection_preview_content.html index 6cad404..f219701 100644 --- a/app/templates/book/components/sub_collection_preview_content.html +++ b/app/templates/book/components/sub_collection_preview_content.html @@ -1,7 +1,9 @@ {% if not collection.is_leaf %} {% for sub_collection in collection.children if not sub_collection.is_deleted%} -##{{sub_collection.label}}
++ ##{{sub_collection.label}} +
{% if not sub_collection.active_sections and not sub_collection.children %}This sub collection is empty
{% endif %} diff --git a/app/templates/book/components/sub_collection_tab_content.html b/app/templates/book/components/sub_collection_tab_content.html index ff93ee5..b6bc544 100644 --- a/app/templates/book/components/sub_collection_tab_content.html +++ b/app/templates/book/components/sub_collection_tab_content.html @@ -2,8 +2,8 @@ {% if not collection.is_leaf %} - {% for sub_collection in collection.children if not - sub_collection.is_deleted%} + + {% for sub_collection in collection.children if not sub_collection.is_deleted%}