Commit b7f07bef authored by Andreas Valder's avatar Andreas Valder
Browse files

now linked courses

parent 60de8f24
......@@ -122,5 +122,14 @@ def search():
'WHERE (? OR (coursevisible AND listed AND visible)) GROUP BY id ORDER BY _score DESC, time DESC LIMIT 30', False)
return render_template('search.html', searchtext=request.args['q'], courses=courses, lectures=lectures)
@app.route('/course')
def course():
if 'courseid' in request.args:
id = request.args['courseid']
return render_template('course.html',
course=query('SELECT * FROM courses WHERE handle = ?', id))
else:
return redirect(url_for('index'))
if __name__ == '__main__':
app.run()
{% from 'macros.html' import course_list_item %}
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% block content %}
<div class="container-fluid">
<div class="col-xs-offset-1 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Veranstaltungen</h1>
</div>
{{course|pprint}}
<ul class="list-group courselist">
{% for course in courses %}
{{ course_list_item(course,true) }}
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}
......@@ -60,22 +60,24 @@
{% 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 }}
<a href=/course?courseid={{course.handle}}>
{% 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-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>
<span class="col-xs-3">
{{ course.organizer }}
</span>
<span class="col-xs-2">
{{ course.subject }}
</span>
</a>
</div>
</li>
{% endmacro %}
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