Commit 45b73410 authored by Andreas Valder's avatar Andreas Valder
Browse files

made video grouping nicer

parent 4b220db7
......@@ -90,7 +90,10 @@ def videos():
for i in c:
if i['semester'] == '':
i['semester'] = 'zeitlos'
return render_template('videos.html', courses=c, groupedby=request.args.get('groupedby'))
groupedby = request.args.get('groupedby')
if groupedby not in ['title','semester','organizer']:
groupedby = 'semester'
return render_template('videos.html', courses=c, groupedby=groupedby)
@app.route('/faq')
def faq():
......
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% block content %}
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h1>Veranstaltungen</h1>
<div class="container-fluid">
<div class="col-xs-offset-1 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">
<h1>Veranstaltungen</h1>
</div>
{% if courses == [] %}
<div class="panel-body">Nichts gefunden!</div>
{% else %}
<ul class="list-group courselist">
{% for course in courses %}
<li class="list-group-item">{{ course['title'] }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="panel-body">
{% if courses == [] %}
Nichts gefunden!
{% else %}
<ul class="list-group courselist">
{% for course in courses %}
<li class="list-group-item">{{ course['title'] }}</li>
<div class="panel panel-default">
<div class="panel-heading">
<h1>Videos</h1>
</div>
<div class="panel-body">
{% if lectures == [] %}
Nichts gefunden!
{% else %}
<ul class="list-group videopreview">
{% for lecture in lectures %}
{{ preview(lecture) }}
{% endfor %}
</ul>
{% endif %}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h1>Videos</h1>
</div>
<div class="panel-body">
{% if lectures == [] %}
Nichts gefunden!
{% else %}
<ul class="list-group videopreview">
{% for lecture in lectures %}
{{ preview(lecture) }}
{% endfor %}
</ul>
{% endif %}
</ul>
{% endif %}
</div>
</div>
</div>
</div>
......
{% from 'macros.html' import course_list_item %}
{% set active_page = 'videos' -%}
{% set groupedby = groupedby|default('semester', true) -%}
{% extends "base.html" %}
{% block content %}
......@@ -11,14 +10,13 @@
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="?groupedby=semester">Semester</a></li>
<li><a href="?groupedby=courses">Veranstaltungen</a></li>
<li><a href="?groupedby=title">Veranstaltungen</a></li>
<li><a href="?groupedby=organizer">Dozenten</a></li>
</ul>
</div>
</div>
<div class="row"><div class="col-xs-offset-1 col-xs-10">
{% if groupedby == 'semester' %}
{% for g in courses|groupby('semester')|reverse %}
{% for g in courses|groupby(groupedby)|reverse %}
<div class="row panel-group">
<div class="col-xs-12"><div class="panel panel-default">
<div class="panel-heading">
......@@ -26,47 +24,16 @@
</div>
<ul class="courses-list list-group">
{% for i in g.list %}
{{ course_list_item(i) }}
{% if groupedby == semester %}
{{ course_list_item(i) }}
{% else %}
{{ course_list_item(i,true) }}
{% endif %}
{% endfor %}
</ul>
</div></div>
</div>
{% endfor %}
{% endif %}
{% if groupedby == 'courses' %}
{% for g in courses|groupby('title')|reverse %}
<div class="row panel-group">
<div class="col-xs-12"><div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">{{g.grouper}}</h1>
</div>
<ul class="courses-list list-group">
{% for i in g.list|sort(attribute='semester') %}
{{ course_list_item(i,true) }}
{% endfor %}
</ul>
</div></div>
</div>
{% endfor %}
{% endif %}
{% if groupedby == 'organizer' %}
{% for g in courses|groupby('organizer')|reverse %}
<div class="row panel-group">
<div class="col-xs-12"><div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">{{g.grouper}}</h1>
</div>
<ul class="courses-list list-group">
{% for i in g.list|sort(attribute='semester') %}
{{ course_list_item(i,true) }}
{% endfor %}
</ul>
</div></div>
</div>
{% endfor %}
{% endif %}
</div></div>
</div>
......
Supports Markdown
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