Commit 4b220db7 authored by Andreas Valder's avatar Andreas Valder
Browse files

added video overwiew with group by

parent f07e215c
......@@ -86,7 +86,11 @@ def index():
@app.route('/videos')
def videos():
return render_template('videos.html')
c=query("SELECT * FROM courses")
for i in c:
if i['semester'] == '':
i['semester'] = 'zeitlos'
return render_template('videos.html', courses=c, groupedby=request.args.get('groupedby'))
@app.route('/faq')
def faq():
......
.videopreview li:nth-child(even) { background: #f5f5f5; }
.courses-list li:nth-child(even) { background: #fAfAfA; }
.mejs-container { height: 80% !important; width: 100% !important; position: fixed !important; }
......@@ -56,3 +56,26 @@
<source type="video/mp4" src="https://videoag.fsmpi.rwth-aachen.de/{{ videos[0]['path'] }}" />
</video>
{% endmacro %}
{% macro course_list_item(course,show_semester=False) %}
<li class="list-group-item">
<div class="row">
{% if show_semester %}
<span class="col-xs-1">
{{ course.semester }}
</span>
<span class="col-xs-6">
{% else %}
<span class="col-xs-7">
{% endif %}
{{ course.title }}
</span>
<span class="col-xs-3">
{{ course.organizer }}
</span>
<span class="col-xs-2">
{{ course.subject }}
</span>
</div>
</li>
{% endmacro %}
{% from 'macros.html' import course_list_item %}
{% set active_page = 'videos' -%}
{% set groupedby = groupedby|default('semester', true) -%}
{% extends "base.html" %}
{% set active_page = "videos" %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Grupierung
<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=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 %}
<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 %}
{{ course_list_item(i) }}
{% 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>
{% endblock %}
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