diff --git a/oarepo_communities/config.py b/oarepo_communities/config.py index f598704..e3e3013 100644 --- a/oarepo_communities/config.py +++ b/oarepo_communities/config.py @@ -8,6 +8,7 @@ from .requests.remove_secondary import RemoveSecondaryCommunityRequestType from .requests.submission_secondary import SecondaryCommunitySubmissionRequestType from .resolvers.ui import CommunityRoleUIResolver +from invenio_communities.config import COMMUNITIES_ROUTES as INVENIO_COMMUNITIES_ROUTES REQUESTS_REGISTERED_TYPES = [ InitiateCommunityMigrationRequestType(), @@ -60,3 +61,9 @@ ], } ] + +COMMUNITIES_ROUTES = {**INVENIO_COMMUNITIES_ROUTES, "my_communities": "/me/communities"} + +DISPLAY_USER_COMMUNITIES = True + +DISPLAY_NEW_COMMUNITIES = True diff --git a/oarepo_communities/ext.py b/oarepo_communities/ext.py index 4e62a32..a724e04 100644 --- a/oarepo_communities/ext.py +++ b/oarepo_communities/ext.py @@ -52,6 +52,10 @@ def init_config(self, app): ) if "OAREPO_PERMISSIONS_PRESETS" not in app.config: app.config["OAREPO_PERMISSIONS_PRESETS"] = {} + app.config.setdefault( + "DISPLAY_USER_COMMUNITIES", config.DISPLAY_USER_COMMUNITIES + ) + app.config.setdefault("DISPLAY_NEW_COMMUNITIES", config.DISPLAY_NEW_COMMUNITIES) for k in ext_config.OAREPO_PERMISSIONS_PRESETS: if k not in app.config["OAREPO_PERMISSIONS_PRESETS"]: @@ -59,6 +63,11 @@ def init_config(self, app): ext_config.OAREPO_PERMISSIONS_PRESETS[k] ) + app.config["COMMUNITIES_ROUTES"] = { + **config.COMMUNITIES_ROUTES, + **app.config.get("COMMUNITIES_ROUTES", {}), + } + @cached_property def urlprefix_serviceid_mapping(self): return get_urlprefix_service_id_mapping() diff --git a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/frontpage.html b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/frontpage.html index 50153b4..5225d2b 100644 --- a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/frontpage.html +++ b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/frontpage.html @@ -35,19 +35,23 @@ {% endblock searchbar %} {%- block user_communities %} -{% if current_user.is_authenticated %} -