Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
cf2dbd3d
Commit
cf2dbd3d
authored
Feb 16, 2017
by
Julian Rother
Browse files
Introduce tagid filter to generate proper element ids
parent
7a769943
Changes
2
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
cf2dbd3d
...
...
@@ -272,6 +272,17 @@ def fixnl(s):
# To be remove, as soon as db schema is cleaned-up
return
str
(
s
).
replace
(
'
\n
'
,
'<br>'
)
@
app
.
template_filter
()
def
tagid
(
s
):
if
not
s
:
return
'EMPTY'
s
=
s
.
replace
(
' '
,
'_'
).
lower
()
r
=
''
for
c
in
s
:
if
c
in
string
.
ascii_lowercase
+
string
.
digits
+
'_'
:
r
=
r
+
c
return
r
@
app
.
route
(
'/'
)
@
register_navbar
(
'Home'
,
icon
=
'home'
)
def
index
():
...
...
templates/courses.html
View file @
cf2dbd3d
...
...
@@ -34,7 +34,7 @@
function
autocollapse
()
{
if
(
$
(
"
#xs-check
"
).
is
(
"
:visible
"
))
{
/* Only expand current semester */
$
(
"
.collapse[id!='{{grouped_courses[1].grouper}}']
"
).
removeClass
(
'
in
'
);
$
(
"
.collapse[id!='{{grouped_courses[1].grouper
|tagid
}}']
"
).
removeClass
(
'
in
'
);
}
}
$
(
document
).
ready
(
autocollapse
);
...
...
@@ -47,7 +47,7 @@
<div
class=
"row panel-group"
id=
"accordion"
>
<div
class=
"col-xs-12"
><div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#accordion"
href=
"#{{g.grouper}}"
style=
"color: #222;"
>
<a
class=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#accordion"
href=
"#{{g.grouper
|tagid
}}"
style=
"color: #222;"
>
{% if groupedby == 'semester' %}
<h1
class=
"panel-title"
>
{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen)
</h1>
{% else %}
...
...
@@ -55,7 +55,7 @@
{% endif %}
</a>
</div>
<ul
class=
"{% if not ismod() %}courses-list {% endif %}list-group panel-collapse collapse in"
id=
"{{g.grouper}}"
>
<ul
class=
"{% if not ismod() %}courses-list {% endif %}list-group panel-collapse collapse in"
id=
"{{g.grouper
|tagid
}}"
>
{% for i in g.list|sort(attribute='title') %}
{% if groupedby == 'semester' %}
{{ course_list_item(i) }}
...
...
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