Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hellenkamp
website
Commits
b7f07bef
Commit
b7f07bef
authored
Aug 24, 2016
by
Andreas Valder
Browse files
now linked courses
parent
60de8f24
Changes
3
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
b7f07bef
...
...
@@ -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
()
templates/course.html
0 → 100644
View file @
b7f07bef
{% 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 %}
templates/macros.html
View file @
b7f07bef
...
...
@@ -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 %}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment