groups/home: add a link to subscribe to a group
[xnet] / xnet / groups / templates / groups / home.html
index 5876512..df120b4 100644 (file)
@@ -8,6 +8,21 @@
         {% if group.web %}
             <p><span>Web</span> : <a href="{{ group.web }}">{{ group.web }}</a></p>
         {% endif %}
+        {% if user.is_authenticated %}
+            <p><span>Inscription</span> :
+            {% if not membership %}
+                Non inscrit.
+                <a href="{% url 'groups:membership-add' group.short user.username %}">
+                    <i class="icon-plus"></i>M'inscrire
+                </a>
+            {% else %}
+                {{ membership.state }}.
+                <a href="{% url 'groups:membership-delete' group.short user.username %}">
+                    <i class="icon-trash"></i>Me désinscrire
+                 </a>
+            {% endif %}
+            </p>
+        {% endif %}
         {% if group.description %}
             <p class="pull-left">{{ group.description }}</p>
         {% endif %}