diff --git a/app/__init__.py b/app/__init__.py index 5517cef..31892cf 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -29,6 +29,7 @@ def create_app(environment="development"): star_blueprint, permissions_blueprint, search_blueprint, + notifications_blueprint, ) from app import models as m @@ -58,6 +59,7 @@ def create_app(environment="development"): app.register_blueprint(star_blueprint) app.register_blueprint(permissions_blueprint) app.register_blueprint(search_blueprint) + app.register_blueprint(notifications_blueprint) # Set up flask login. @login_manager.user_loader diff --git a/app/models/user.py b/app/models/user.py index 50029be..665faf8 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -71,6 +71,16 @@ class User(BaseModel, UserMixin): contributions.append(comment.interpretation) return contributions + @property + def active_notifications(self): + items = [ + notification + for notification in self.notifications + if not notification.is_read + ] + items.sort(key=lambda x: x.created_at) + return items + class AnonymousUser(AnonymousUserMixin): pass diff --git a/app/templates/book/components/collection_context_menu.html b/app/templates/book/components/collection_context_menu.html index 55cab4f..d091cbc 100644 --- a/app/templates/book/components/collection_context_menu.html +++ b/app/templates/book/components/collection_context_menu.html @@ -8,28 +8,28 @@ {% if access_to_create_collections or access_to_update_collections %} {% endif %} + +{% if not access_to_create_collections_in_root and not access_to_create_collections and not access_to_update_collections and not access_to_delete_collections and not access_to_create_section %} +{% endif %} + {% else %} {% endif %} - + +{% if not access_to_create_sections and not access_to_update_sections and not access_to_delete_sections %} +{% endif %} + {% else %}