Commit 594a9213 authored by Andreas Valder's avatar Andreas Valder
Browse files

added upcomming lectures

parent eb297833
......@@ -111,6 +111,10 @@ def human_semester(s, long=False):
def human_date(d):
return d.strftime('%d.%m.%Y')
@app.template_filter(name='time')
def human_date(d):
return d.strftime('%H:%M')
@app.template_filter()
def rfc3339(d):
return d.strftime('%Y-%m-%dT%H:%M:%S+02:00')
......@@ -118,16 +122,25 @@ def rfc3339(d):
@app.route('/')
@register_navbar('Home', icon='home')
def index():
return render_template('index.html', latestvideos=query('''
SELECT lectures.*, max(videos.time_updated) AS lastvidtime, courses.short, courses.downloadable, courses.title AS coursetitle
FROM lectures
LEFT JOIN videos ON (videos.lecture_id = lectures.id)
LEFT JOIN courses on (courses.id = lectures.course_id)
WHERE (? OR (courses.visible AND courses.listed AND lectures.visible AND videos.visible))
GROUP BY videos.lecture_id
ORDER BY lastvidtime DESC
LIMIT 6
''', ismod()))
upcomming = query ('''
SELECT lectures.*,courses.short, courses.title AS course_title
FROM lectures
JOIN courses ON (lectures.course_id = courses.id)
WHERE (time > ?)
ORDER BY time ASC LIMIT 7''',datetime.today())
for i in upcomming:
i['date'] = i['time'].date()
i['time'] = i['time'].time()
latestvideos=query('''
SELECT lectures.*, max(videos.time_updated) AS lastvidtime, courses.short, courses.downloadable, courses.title AS coursetitle
FROM lectures
LEFT JOIN videos ON (videos.lecture_id = lectures.id)
LEFT JOIN courses on (courses.id = lectures.course_id)
WHERE (? OR (courses.visible AND courses.listed AND lectures.visible AND videos.visible))
GROUP BY videos.lecture_id
ORDER BY lastvidtime DESC
LIMIT 6 ''',ismod())
return render_template('index.html', latestvideos=latestvideos, upcomming=upcomming)
@app.route('/course')
@register_navbar('Videos', icon='film')
......
{% from 'macros.html' import lecture_list_item %}
{% from 'macros.html' import valueeditor %}
{% from 'macros.html' import valuedeletebtn %}
{% from 'macros.html' import valuecheckbox %}
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">{{ valueeditor(['courses',course.id,'title'], course.title)}}</h1>
<h1 class="panel-title">{{ valueeditor(['courses',course.id,'title'], course.title)}}<span class="pull-right">{{ valuedeletebtn(['courses',course.id,'deleted']) }}</span></h1>
</div>
<div class="row panel-body">
<div class="col-xs-12">
<table class="table-condensed">
<div class="col-xs-12" class="table-condensed">
<table>
<tbody>
<tr><td>Semester:</td><td>{{ valueeditor(['courses',course.id,'semester'], course.semester) }}</td></tr>
<tr><td>Veranstalter:</td><td>{{ valueeditor(['courses',course.id,'organizer'], course.organizer) }}</td></tr>
<tr><td>Bemerkungen:</td><td>{{ valueeditor(['courses',course.id,'description'], course.description) }}</td></tr>
{% if ismod() %}
</tbody>
</table>
</div>
{% if ismod() %}
<div class="col-xs-12" style="margin-top: 20px">
<table class="table-condensed">
<tbody>
<tr><td>Sichtbar:</td><td>{{ valuecheckbox(['courses',course.id,'visible'], course.visible) }}</td></tr>
<tr><td>Gelistet:</td><td>{{ valuecheckbox(['courses',course.id,'listed'], course.listed) }}</td></tr>
<tr><td>Downloadable:</td><td>{{ valuecheckbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
<tr><td>Short:</td><td>{{ valueeditor(['courses',course.id,'short'], course.short) }}</td></tr>
<tr><td>Handle:</td><td>{{ valueeditor(['courses',course.id,'handle'], course.handle) }}</td></tr>
<tr><td>Downloadable:</td><td>{{ valuecheckbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
<tr><td>Thema:</td><td>{{ valueeditor(['courses',course.id,'subject'], course.subject) }}</td></tr>
<tr><td>Zuständig:</td><td>{{ valueeditor(['courses',course.id,'responsible'], course.responsible) }}</td></tr>
{% endif %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
<div class="panel panel-default">
......
......@@ -2,7 +2,7 @@
{% extends "base.html" %}
{% block content %}
<div clss="row">
<div class="row-xs-12">
<div class="col-xs-12" style="padding: 0px;">
<ul class="list-inline pull-right">
<li>
<a class="fa fa-rss-square btn btn-default" aria-hidden="true" href="{{url_for('courses_feed')}}"></a>
......@@ -12,7 +12,7 @@
<a class="btn btn-default" href="{{ url_for('new_course', ref=request.url) }}">Neue Veranstaltung</a>
</li>
{% endif %}
<li class="dropdown">
<li class="dropdown" style="padding-right: 0px">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Gruppierung
<span class="caret"></span>
</button>
......
......@@ -29,6 +29,26 @@
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Nächste Aufnahmen</h1">
</div>
<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">
{{i.time|time}} {{i.place}} <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>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Neueste Videos <a class="fa fa-rss-square pull-right" aria-hidden="true" href="{{url_for('feed')}}"></a></h1">
......
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