courses.html 2.64 KB
Newer Older
1
2
3
{% from 'macros.html' import course_list_item %}
{% extends "base.html" %}
{% block content %}
4
<div clss="row">
Andreas Valder's avatar
Andreas Valder committed
5
	<div class="col-xs-12" style="padding: 0px;">
6
7
		<ul class="list-inline pull-right">
			<li>
Andreas Valder's avatar
Andreas Valder committed
8
				 <a class="fa fa-rss-square btn btn-default" aria-hidden="true" href="{{url_for('courses_feed')}}" style="text-decoration: none"></a>
9
10
11
			</li>
			{% if ismod() %} 
			<li>
Julian Rother's avatar
Julian Rother committed
12
13
				{% set newhandle = 'new'+(randint(0,1000)|string) %}
				<a class="btn btn-default" href="{{ url_for('create', table='courses', handle=newhandle, title='Neue Veranstaltung', responsible=session.user.givenName, ref=url_for('course', handle=newhandle)) }}">Neue Veranstaltung</a>
14
15
			</li>
			{% endif %}
Andreas Valder's avatar
Andreas Valder committed
16
			<li class="dropdown" style="padding-right: 0px">
17
18
19
20
21
				<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Gruppierung
					<span class="caret"></span>
				</button>
				<ul class="dropdown-menu dropdown-menu-right">
					<li><a href="?groupedby=semester">Semester</a></li>
Julian Rother's avatar
Julian Rother committed
22
23
24
					<li><a href="?groupedby=title">Veranstaltung</a></li>
					<li><a href="?groupedby=organizer">Dozent</a></li>
					<li><a href="?groupedby=subject">Kategorie</a></li>
25
26
				</ul>
			</li>
27
28
29
		</ul>
	</div>
</div>
Andreas Valder's avatar
Andreas Valder committed
30

31
<div class="visible-xs" id="xs-check"></div>
Andreas Valder's avatar
Andreas Valder committed
32
{% if groupedby == 'semester' %}
33
34
	{% set grouped_courses = courses|groupby(groupedby)|reverse|list %}
	<script>
Andreas Valder's avatar
Andreas Valder committed
35
		$(function () {
36
37
			if($("#xs-check").is(":visible")) {
				/* Only expand current semester */
38
				$(".collapse[id!='{{grouped_courses[1].grouper|tagid}}']").removeClass('in');
39
			}
Andreas Valder's avatar
Andreas Valder committed
40
		});
41
	</script>
Andreas Valder's avatar
Andreas Valder committed
42
{% else %}
43
44
	{% set grouped_courses = courses|groupby(groupedby)|list %}
	<script>
Andreas Valder's avatar
Andreas Valder committed
45
		$(function () {
46
47
48
			if($("#xs-check").is(":visible")) {
				$(".collapse[id!='{{grouped_courses[0].grouper|tagid}}']").removeClass('in');
			}
Andreas Valder's avatar
Andreas Valder committed
49
		});
50
	</script>
Andreas Valder's avatar
Andreas Valder committed
51
52
53
{% endif %}

{% for g in grouped_courses %}
54
<div class="row panel-group" id="accordion">
55
56
	<div class="col-xs-12"><div class="panel panel-default">
		<div class="panel-heading">
57
			<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#{{g.grouper|tagid}}" style="color: #222;">
58
59
60
61
62
63
				{% if groupedby == 'semester' %}
				<h1 class="panel-title">{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen)</h1>
				{% else %}
				<h1 class="panel-title">{{g.grouper}}</h1>
				{% endif %}
			</a>
64
		</div>
65
		<ul class="{% if not ismod() %}courses-list {% endif %}list-group panel-collapse collapse in" id="{{g.grouper|tagid}}">
66
			{% for i in g.list %}
67
68
69
70
71
72
73
74
75
				{% if groupedby == 'semester' %}
					{{ course_list_item(i) }}
				{% else %}
					{{ course_list_item(i,true) }}
				{% endif %}
			{% endfor %}
		</ul>
	</div></div>
</div>
76
{% endfor %}
77
{% endblock %}