Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: community theme and menus visibility #1126

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading