Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
6bb2fe36
Commit
6bb2fe36
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Implemented fancy semester naming
parent
31a90ae3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.py
+15
-3
15 additions, 3 deletions
server.py
templates/course.html
+4
-0
4 additions, 0 deletions
templates/course.html
with
19 additions
and
3 deletions
server.py
+
15
−
3
View file @
6bb2fe36
...
...
@@ -7,7 +7,7 @@ import os
import
hashlib
import
locale
locale
.
setlocale
(
locale
.
LC_ALL
,
'
de_DE
'
)
locale
.
setlocale
(
locale
.
LC_ALL
,
'
de_DE
.UTF-8
'
)
app
=
Flask
(
__name__
)
...
...
@@ -94,8 +94,20 @@ def handle_not_found(e):
return
render_endpoint
(
'
index
'
,
'
Diese Seite existiert nicht!
'
),
404
@app.template_filter
(
name
=
'
semester
'
)
def
human_semester
(
s
):
return
s
def
human_semester
(
s
,
long
=
False
):
if
not
s
or
s
==
'
zeitlos
'
or
len
(
s
)
!=
6
:
return
'
Zeitlos
'
year
=
s
[
0
:
4
]
semester
=
s
[
4
:
6
].
upper
()
if
not
year
.
isdigit
()
or
semester
not
in
[
'
SS
'
,
'
WS
'
]:
print
(
'
Invalid semester string
"
%s
"'
%
s
)
return
'
??
'
if
not
long
:
return
semester
+
year
[
2
:]
elif
semester
==
'
SS
'
:
return
'
Sommersemester %s
'
%
year
else
:
return
'
Wintersemester %s/%s
'
%
(
year
,
str
(
int
(
year
)
+
1
)[
2
:])
@app.template_filter
(
name
=
'
date
'
)
def
human_date
(
d
):
...
...
This diff is collapsed.
Click to expand it.
templates/course.html
+
4
−
0
View file @
6bb2fe36
...
...
@@ -20,7 +20,11 @@
<div
class=
"row panel-group"
>
<div
class=
"col-xs-12"
><div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
{% if groupedby == 'semester' %}
<h1
class=
"panel-title"
>
{{g.grouper|semester(long=True)}}
</h1>
{% else %}
<h1
class=
"panel-title"
>
{{g.grouper}}
</h1>
{% endif %}
</div>
<ul
class=
"{% if not ismod() %}courses-list {% endif %}list-group"
>
{% for i in g.list %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment