index.html 6.7 KB
Newer Older
Julian Rother's avatar
Julian Rother committed
1
{% from 'macros.html' import preview, course_list_item %}
Andreas Valder's avatar
Andreas Valder committed
2
{% extends "base.html" %}
3
{% set page_border = 0 %}
4
5
6
7
8
9
{% if ismod() %}
	{# Little hack to not show annoucements twice #}
	{% set min_announcement_level = 999 %}
{% else %}
	{% set min_announcement_level = 0 %}
{% endif %}
Andreas Valder's avatar
Andreas Valder committed
10
{% block content %}
11
{% if ismod() %}
12
13
<div class="row">
	<div class="col-xs-12">
14
		{% for msg in get_announcements() %}
Andreas Valder's avatar
Andreas Valder committed
15
16
		<div class="alert alert-{{levels.get(msg.level, ('info', ''))[0]}}" role="alert">
			<div>
17
18
				<div class="pull-right">{{ moderator_delete(('announcements',msg.id,'deleted')) }}</div>
				<div>{{ moderator_editor(('announcements',msg.id,'text'), msg.text) }}</div>
19
			</div>
Andreas Valder's avatar
Andreas Valder committed
20
			<div>
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
				<ul class="list-inline">
					<li>
						{% if not msg.visible %}
							<a href="{{ url_for('edit', prefix='announcements.'+msg.id|string+'.', ref=request.url, visible=1) }}" class="btn btn-primary">Veröffentlichen</a>
						{% elif msg.time_expire and msg.time_expire < datetime.now() %}
							<a href="#" class="btn btn-danger disabled">Abgelaufen</a>
						{% elif msg.time_publish and msg.time_publish > datetime.now() %}
							<a href="#" class="btn btn-default disabled">Geplant</a>
						{% else %}
							<a href="#" class="btn btn-success disabled">Öffentlich</a>
						{% endif %}
					</li>
					<li class="dropdown">
						<span class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">{{levels.get(msg.level, ('', 'Unbekannt'))[1]}} <span class="caret"></span></span>
						<ul class="dropdown-menu">
							{% for level, descr in levels.items() %}
								<li><a href="{{ url_for('edit', prefix='announcements.'+(msg.id|string)+'.', ref=request.url, level=level) }}">{{ descr[1] }}</a></li>
							{% endfor %}
						</ul>
					</li>
					<li>
42
						Aktiv von {{ moderator_editor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
43
44
					</li>
					<li>
45
						bis {{ moderator_editor(('announcements',msg.id,'time_expire'), msg.time_expire) }}
46
47
48
					</li>
				</ul>
			</div>
49
50
51
52
53
54
55
		</div>
		{% endfor %}
	</div>
</div>
<div class="row">
	<div class="col-xs-12">
		<ul class="list-inline pull-right">
Julian Rother's avatar
Julian Rother committed
56
57
58
59
60
61
			<li style="padding-right: 0px;">
				<div class="btn-group">
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Neues Panel <span class="caret"></span></button>
					<ul class="dropdown-menu">
						<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url, order=newfeatured) }}">Nur Text</a></li>
						<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url, order=newfeatured) }}">Text mit Bild</a></li>
Julian Rother's avatar
Julian Rother committed
62
						<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='courses', param='semester', param2='', ref=request.url, order=newfeatured) }}">Veranstaltungsliste</a></li>
Julian Rother's avatar
Julian Rother committed
63
64
65
					</ul>
				</div>
			</li>
66
			<li style="padding-right: 0px;">
67
				<a class="btn btn-default" href="{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}">Neue Ankündigung</a>
68
			</li>
69
70
71
		</ul>
	</div>
</div>
72
{% endif %}
73
<div class="row">
74
	<div class="col-md-6">
75
		{% for item in featured %}
76
77
		<div class="panel panel-default">
			<div class="panel-heading">
78
79
				<h1 class="panel-title">
					{{ moderator_editor(('featured',item.id,'title'), item.title) }} {{ moderator_checkbox(('featured',item.id,'visible'), item.visible) }}
80
					{% if ismod() %}
81
					<ul class="pull-right list-inline">
82
83
84
85
86
87
						{% if not loop.first %}
						<li><a class="btn btn-default" href="{{ url_for('edit', **{'featured.'+item.id|string+'.order': featured[loop.index0-1].order, 'featured.'+featured[loop.index0-1].id|string+'.order': item.order, 'ref': request.url})}}"><span class="glyphicon glyphicon-arrow-up"></span></a></li>
						{% endif %}
						{% if not loop.last %}
						<li><a class="btn btn-default" href="{{ url_for('edit', **{'featured.'+item.id|string+'.order': featured[loop.index0+1].order, 'featured.'+featured[loop.index0+1].id|string+'.order': item.order, 'ref': request.url})}}"><span class="glyphicon glyphicon-arrow-down"></span></a></li>
						{% endif %}
88
89
						<li>{{ moderator_delete(['featured',item.id,'deleted']) }}</li>
					</ul>
90
					{% endif %}
91
				</h1>
Andreas Valder's avatar
Andreas Valder committed
92
			</div>
93
94
95
96
97
98
99
100
			{% if item.type == 'image' %}
				<!-- Putting image tag here makes it borderless. This should be replaced by a bootstrap-compatible solution. -->
				<img src="{{item.param}}" style="width: 100%;"/>
				{% if ismod() %}
				<p>{{moderator_editor(('featured',item.id,'param'), item.param)}}</p>
				{% endif %}
			{% endif %}
			{% if item.text or ismod() %}
101
			<div class="panel-body">
102
				{{ moderator_editor(('featured',item.id,'text'), item.text) }}
Andreas Valder's avatar
Andreas Valder committed
103
			</div>
104
			{% endif %}
Julian Rother's avatar
Julian Rother committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
			{% if item.type == 'courses' %}
				<ul class="courses-list list-group">
				{% for i in item.courses %}
					{{ course_list_item(i) }}
				{% endfor %}
				</ul>
				<div class="panel-footer">
				{% if ismod() %}
				<p>Kategorie: {{ moderator_editor(('featured',item.id,'param'), item.param) }}</p>
				<p>Parameter: {{ moderator_editor(('featured',item.id,'param2'), item.param2) }}</p>
				{% endif %}
				Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>.
				</div>
			{% endif %}
Andreas Valder's avatar
Andreas Valder committed
119
		</div>
120
		{% endfor %}
121
122
	</div>
	<div class="col-md-6">
Andreas Valder's avatar
Andreas Valder committed
123
124
125
126
		<div class="panel panel-default">
			<div class="panel-heading">
				<h1 class="panel-title">Nächste Aufnahmen</h1">
			</div>
127
128
129
130
131
132
133
134
			{% if upcomming|length > 0 %}
				<ul class="list-group">
					{% for g in upcomming|groupby('date') %}
						<li class="list-group-item">
							<ul class="list-group" style="margin: 0px;">
								<strong>{{ g.grouper|date }}</strong>
								{% for i in g.list %}
								<li class="list-group-item list-group-item-condensed">
135
									{{i.time|time}} <a href="{{url_for('course', id=i.course_id)}}">{{i.course.title}}</a>: <a href="{{url_for('course', id=i.course_id)}}#lecture-{{i.id}}">{{i.title}}</a>
Andreas Valder's avatar
Andreas Valder committed
136

137
138
139
140
141
142
143
								</li>
								{% endfor %}
							</ul>
						</li>
					{% endfor %}
				</ul>
			{% else %}
144
145
146
				<div class="panel-body">
					<p>In den nächsten 7 Tagen wird noch nichts aufgenommen oder gestreamt.</p>
				</div>
147
			{% endif %}
Andreas Valder's avatar
Andreas Valder committed
148
		</div>
149
150
		<div class="panel panel-default">
			<div class="panel-heading">
Andreas Valder's avatar
Andreas Valder committed
151
				<h1 class="panel-title">Neueste Videos <a class="fa fa-rss-square pull-right" aria-hidden="true" href="{{url_for('feed')}}"  style="text-decoration: none"></a></h1">
152
153
154
155
156
157
			</div>
			<ul class="list-group videopreview">
				{% for i in latestvideos %}
					{{ preview(i) }}
				{% endfor %}
			</ul>
Andreas Valder's avatar
Andreas Valder committed
158
159
160
161
		</div>
	</div>
</div>
{% endblock %}