Commit 96125f99 authored by Robert's avatar Robert

Add membership application links to group page

parent 44e85ca0
Pipeline #1825 passed with stage
in 7 minutes and 29 seconds
from grouprise.features.associations import models as associations
from grouprise.features.gestalten import rules as gestalten
from grouprise.features.groups.rules import is_closed
from grouprise.features.memberships import predicates as memberships
from grouprise.features.memberships.predicates import is_member_of
import rules
......@@ -23,15 +23,15 @@ rules.add_perm(
rules.add_perm(
'conversations.create_group_conversation_by_email',
memberships.is_member_of)
is_member_of)
rules.add_perm(
'conversations.create_group_conversation_with_membership_application',
is_closed)
is_closed & ~is_member_of)
rules.add_perm(
'conversations.list_group',
memberships.is_member_of)
is_member_of)
rules.add_perm(
'conversations.reply',
......
......@@ -61,6 +61,7 @@
{% has_perm 'memberships.view_list' user group as can_list %}
{% has_perm 'sharing.invite_member' user group as can_invite %}
{% has_perm 'memberships.try_to_join' user group as can_join %}
{% has_perm 'conversations.create_group_conversation_with_membership_application' user group as can_apply %}
<dt>
<i class="sg sg-members"></i>
......@@ -77,25 +78,23 @@
{% if can_join %}
&middot; <a href="{% url 'join' group.slug %}">Beitreten</a>
{% elif can_invite %}
&middot; <a href="{% url 'member-invite' group.pk %}">Einladen</a>
&middot; <a href="{% url 'member-invite' group.pk %}">Mitglied einladen</a>
{% elif can_create %}
&middot; <a href="{% url 'member-create' group.pk %}">Aufnehmen</a>
&middot; <a href="{% url 'member-create' group.pk %}">Mitglied aufnehmen</a>
{% elif can_apply %}
&middot; <a href="{% url 'create-group-conversation' group.pk %}?apply_for_membership=1">Mitgliedschaft beantragen</a>
{% else %}
&middot; <a href="{% url 'recommend-group' group.slug %}">Weiterempfehlen</a>
&middot; <a href="{% url 'recommend-group' group.slug %}">Gruppe weiterempfehlen</a>
{% endif %}
</dd>
{% if group.closed %}
{% if group.closed and can_list %}
<dt>
<i class="sg sg-closed"></i>
<span class="sr-only">Geschlossene Gruppe</span>
</dt>
<dd>
Geschlossene Gruppe{% if not can_list %}:
<span title="Im Verlauf des Gesprächs kannst Du die Mitgliedschaft beantragen.">
<a href="{% url 'create-group-conversation' group.pk %}">Gespräch beginnen</a>
um Mitgliedschaft zu beantragen{% endif %}
</span>
Geschlossene Gruppe
</dd>
{% endif %}
......
......@@ -14,10 +14,15 @@
{# MEMBERSHIP #}
{% load rules %}
{% has_perm 'memberships.try_to_join' user group as can_join %}
{% has_perm 'conversations.create_group_conversation_with_membership_application' user group as can_apply %}
{% if can_join %}
<a href="{% url 'join' group.slug %}" class="btn btn-default btn-sm" title="Der Gruppe beitreten">
<i class="sg sg-join"></i> Beitreten
</a>
{% elif can_apply %}
<a href="{% url 'create-group-conversation' group.pk %}?apply_for_membership=1" class="btn btn-default btn-sm" title="Mitgliedschaft beantragen">
<i class="sg sg-join"></i> Mitgliedschaft beantragen
</a>
{% endif %}
{# SUBSCRIPTION #}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment