diff --git a/server.py b/server.py index 29a44dd1a41ccfc984b72f30ddcfc4b4f58fc604..ea711cca7fd1eba32fda96482e9b40e893f465c9 100755 --- a/server.py +++ b/server.py @@ -123,6 +123,11 @@ def rfc3339(d): def get_announcements(minlevel=0): return query('SELECT * FROM announcements WHERE NOT deleted AND (? OR visible) AND level >= ? ORDER BY level DESC', ismod(), minlevel) +@app.template_filter() +def fixnl(s): + # To be remove, as soon as db schema is cleaned-up + return str(s).replace('\n', '<br>') + @app.route('/') @register_navbar('Home', icon='home') def index(): diff --git a/static/style.css b/static/style.css index d4aab31c9619793a044752b1b1b515befa659de6..71c02bf37e4a1bf7b6141883cd1afff5e4c35121 100644 --- a/static/style.css +++ b/static/style.css @@ -4,3 +4,5 @@ @media (min-width: 767px) { .list-group-item-condensed { padding-top: 2px !important; padding-bottom: 2px !important; } } + +.table-top-aligned tr { vertical-align: top; } diff --git a/templates/course.html b/templates/course.html index 1bcfc6e4e1fe97b4bbecc0016d7be77480269f7b..48c70f6fff3c0cd544dc26f55ca45e64d335b590 100644 --- a/templates/course.html +++ b/templates/course.html @@ -10,8 +10,8 @@ <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" class="table-condensed"> - <table> + <div class="col-xs-12"> + <table class="table-top-aligned table-condensed"> <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> @@ -21,7 +21,7 @@ </div> {% if ismod() %} <div class="col-xs-12" style="margin-top: 20px"> - <table class="table-condensed"> + <table class="table-condensed table-top-aligned"> <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> diff --git a/templates/macros.html b/templates/macros.html index c8d03dbbf5cd8a2347b24e6c848e4c42cdebbc19..8d5e6a4cf79614ed7cdd8a1934751b606d31fb53 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -11,8 +11,8 @@ {% endif %} </div> <div class="col-xs-4"> - <div>{{ lecture['title'] }}</div> - <p style="font-style: italic; color: #777;">{{ lecture['comment'] }}</p> + <div>{{ lecture['title']|fixnl|safe }}</div> + <p style="font-style: italic; color: #777;">{{ lecture['comment']|fixnl|safe }}</p> </div> </div> </a> @@ -26,14 +26,14 @@ </li> {% if lecture['speaker'] %} <li> - <span class="small">Gehalten von {{ lecture['speaker'] }} </span> + <span class="small">Gehalten von {{ lecture['speaker']|safe }} </span> </li> {% endif %} <li> - {{ lecture['title'] }} + {{ lecture['title']|fixnl|safe }} </li> <li> - <p style="font-style: italic; color: #777;">{{ lecture['comment'] }}</p> + <p style="font-style: italic; color: #777;">{{ lecture['comment']|fixnl|safe }}</p> </li> </ul> </a> @@ -169,7 +169,7 @@ $('#embedcodebtn').popover( {% if ismod() %} <span class="modeditable" data-path="{{path|join('.')}}" ><a class="modeditablesign btn btn-default" tabindex="0" style="padding: 3px; margin-right: 5px;"><span class="glyphicon glyphicon-pencil"></span></a><span class="modeditablevalue">{{ value|safe }}</span></span> {% else %} - {{value|safe}} + {{value|fixnl|safe}} {% endif %} {% endmacro %}