diff --git a/aula/Group/routes.py b/aula/Group/routes.py index 7646b2f..ed9394e 100644 --- a/aula/Group/routes.py +++ b/aula/Group/routes.py @@ -47,7 +47,7 @@ def join(group_id): current_user.join_group(group_id) flash(f'Du er nu tilmeldt {group.name} gruppen', 'success') - return redirect(f"/groups") + return redirect(f"/groups/{group_id}") @Group.route("/groups/leave/", methods=['GET']) def leave(group_id): diff --git a/aula/templates/group_show.html b/aula/templates/group_show.html index 1878c05..9537fac 100644 --- a/aula/templates/group_show.html +++ b/aula/templates/group_show.html @@ -1,6 +1,7 @@ {% extends "layout.html" %} {% block content %} -

{{ group.name }}

+

{{ group.name }} +


{% if posts|length == 0 %}

Gruppen har ingen opslag endnu

@@ -17,6 +18,8 @@ {% endfor %} + + {% if current_user.is_member_of_group(group.group_id) %}

Skriv opslag

@@ -31,20 +34,41 @@
+ {% endif %} {% endblock content %} {% block sidebar %} + {% if current_user.is_member_of_group(group.group_id) %}

Gruppe tråde

- {% if threads|length == 0 %} -

Gruppen har ingen tråde endnu

+ {% if threads|length == 0 %} +

Gruppen har ingen tråde endnu

+ {% endif %} + {% for thread in threads %} +

{{ thread.title }}

+ {% endfor %} +
+
+ {{ form.group_id(value=group.group_id) }} +

{{ form.title(class="form-control", placeholder="Trådens title") }}

+

{{ form.submit(class="btn btn-primary btn-block", value="Start tråd") }}

+
+ + {% else %} + +

Tilmeld dig gruppe for at se gruppe tråde og skrive opslag

+

Tilmeld

+ {% endif %} - {% for thread in threads %} -

{{ thread.title }}

- {% endfor %} + + {% if current_user.is_member_of_group(group.group_id) %} +


-
- {{ form.group_id(value=group.group_id) }} -

{{ form.title(class="form-control", placeholder="Trådens title") }}

-

{{ form.submit(class="btn btn-primary btn-block", value="Start tråd") }}

-
+ {% if group.mandatory %} + Obligatorisk gruppe + {% else %} + Forlad gruppen + {% endif %} +

+ {% endif %} + {% endblock sidebar %} diff --git a/aula/templates/thread_show.html b/aula/templates/thread_show.html index 33058c4..0fc42b5 100644 --- a/aula/templates/thread_show.html +++ b/aula/templates/thread_show.html @@ -30,3 +30,8 @@ {% endblock content %} + +{% block sidebar %} +{{thread.group.name}} + +{% endblock sidebar %} diff --git a/aula/templates/threads.html b/aula/templates/threads.html index ccc6415..8716f89 100644 --- a/aula/templates/threads.html +++ b/aula/templates/threads.html @@ -5,6 +5,7 @@ {% for thread in threads %}
{{thread.title}} + {{thread.group.name}}
{% endfor %} {% endblock content %}