Skip to content

Commit

Permalink
fix: community theme and menus visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ptamarit authored and slint committed Apr 15, 2024
1 parent 593cd38 commit 83d5c17
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
17 changes: 12 additions & 5 deletions invenio_communities/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
from .cache.cache import IdentityCache
from .roles import RoleRegistry
from .utils import load_community_needs, on_datastore_post_commit
from .views.ui import _can_create_community
from .views.ui import (
_has_about_page_content,
_has_curation_policy_page_content,
_show_create_community_link,
)


class InvenioCommunities(object):
Expand Down Expand Up @@ -132,8 +136,8 @@ def register_menus(app):
current_menu.submenu("plus.community").register(
endpoint="invenio_communities.communities_new",
text=_("New community"),
order=3,
visible_when=_can_create_community,
order=2,
visible_when=_show_create_community_link,
)

communities = current_menu.submenu("communities")
Expand All @@ -143,14 +147,14 @@ def register_menus(app):
text=_("Requests"),
order=20,
expected_args=["pid_value"],
**{"icon": "comments", "permissions": "can_search_requests"}
**{"icon": "inbox", "permissions": "can_search_requests"}
)
communities.submenu("members").register(
endpoint="invenio_communities.members",
text=_("Members"),
order=30,
expected_args=["pid_value"],
**{"icon": "users", "permissions": "can_read"}
**{"icon": "users", "permissions": "can_members_search_public"}
)

communities.submenu("settings").register(
Expand All @@ -160,17 +164,20 @@ def register_menus(app):
expected_args=["pid_value"],
**{"icon": "settings", "permissions": "can_update"}
)

communities.submenu("curation_policy").register(
endpoint="invenio_communities.communities_curation_policy",
text=_("Curation policy"),
order=50,
visible_when=_has_curation_policy_page_content,
expected_args=["pid_value"],
**{"icon": "balance scale", "permissions": "can_read"}
)
communities.submenu("about").register(
endpoint="invenio_communities.communities_about",
text=_("About"),
order=60,
visible_when=_has_about_page_content,
expected_args=["pid_value"],
**{"icon": "info", "permissions": "can_read"}
)
Expand Down
7 changes: 7 additions & 0 deletions invenio_communities/views/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
communities_settings_curation_policy,
communities_settings_pages,
communities_settings_privileges,
community_theme_css_config,
invitations,
members,
)
Expand Down Expand Up @@ -191,6 +192,12 @@ def create_ui_blueprint(app):

blueprint.add_url_rule(routes["invitations"], view_func=invitations)

# theme injection view
blueprint.add_url_rule(
"/communities/<pid_value>/community-theme-<revision>.css",
view_func=community_theme_css_config,
)

# Register error handlers
blueprint.register_error_handler(
PermissionDeniedError, record_permission_denied_error
Expand Down

0 comments on commit 83d5c17

Please sign in to comment.