{# SPDX-FileCopyrightText: 2016-2024 CERN. SPDX-FileCopyrightText: 2024-2026 Northwestern University. SPDX-FileCopyrightText: 2025 Graz University of Technology. SPDX-License-Identifier: MIT #} {%- from "invenio_theme/macros/truncate.html" import truncate_text %} {%- from "invenio_communities/details/macros/access-status-label.html" import access_status_label -%} {% macro button_for_membership(community_ui) %} {# Macro to display the button related to membership (request or discussion) #} {# Ths conditionals try hard to reduce the need for a DB hit #} {% if config.COMMUNITIES_ALLOW_MEMBERSHIP_REQUESTS %} {% if community_ui["access"]["member_policy"] == "open" %} {# TODO: Create a new temporary and off-the-books community role for pending members and leverage it in permission checks to forego the need to hit the database every time. #} {% set request_id_of_pending_member = get_request_id_of_pending_member(g.identity, community_ui["id"]) %} {# None if no pending membership or invitation request #} {% if request_id_of_pending_member %} {{ _("Membership discussion") }} {% elif permissions.can_request_membership %}
{% endif %} {% endif %} {% endif %} {% endmacro %} {% macro community_title(community_ui) %}
{{ community_ui["metadata"]["title"] }} {% if community_ui['parent'] %}

{% endif %}
{% endmacro %}
{%- block subheader_metadata %}
{{community_title(community_ui)}}
{{community_title(community_ui)}} {% if community_ui["access"]["visibility"] == 'restricted' %}
{{ access_status_label() }}
{% endif %}
{% if community_ui["access"]["visibility"] == 'restricted' %}
{{ access_status_label() }}
{% endif %} {% if community_ui['parent'] %} {% endif %} {% if community_ui["metadata"]["website"] %} {% endif %} {% if community_ui["metadata"]["type"] is defined %}
{{ community_ui["ui"]["type"]["title_l10n"] }}
{% endif %} {% if community_ui["metadata"]["organizations"] %}
{% endif %}
{%- endblock subheader_metadata %} {%- block subheader_buttons %}
{{ button_for_membership(community_ui) }} {%- if not community_use_jinja_header %} {%- if not permissions.can_submit_record %}
{% endif %} {{ _("New upload") }} {% endif %} {% if permissions.can_moderate %} {{ _("Manage community") }} {% endif %}
{%- endblock subheader_buttons %}
{%- block subheader_menu %} {%- endblock subheader_menu %}