Skip to content
Snippets Groups Projects
Commit ebdc2314 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add tooltips [TIMETABLE/SUBSTITUTIONS]

parent f451e637
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -122,7 +122,8 @@
{# {% else %}#}
{# <strong>{{ sub.teacher_old.shortcode }}</strong>#}
{# {% endif %}#}
{{ sub.teacher|safe }}
<span class="tooltipped" data-position="bottom"
data-tooltip="{{ sub.teacher_full|safe }}">{{ sub.teacher|safe }}</span>
</td>
<td>
{# {% if sub.type == 3 %}#}
......@@ -156,7 +157,8 @@
{# {{ sub.room_old.shortcode }}#}
{# </strong>#}
{# {% endif %}#}
{{ sub.room|safe }}
<span class="tooltipped" data-position="bottom"
data-tooltip="{{ sub.room_full|safe }}">{{ sub.room|safe }}</span>
</td>
<td>
{# <em>{{ sub.text|default:"" }}</em>#}
......
......@@ -140,12 +140,67 @@ class SubRow(object):
self.lesson = ""
self.classes = ""
self.teacher = ""
self.teacher_full = ""
self.subject = ""
self.subject_full = ""
self.room = ""
self.room_full = ""
self.text = ""
self.extra = ""
def generate_teacher_row(sub, full=False):
if sub.type == 1:
teacher = "<s>{}</s>".format(sub.teacher_old.shortcode if not full else sub.teacher_old.name)
elif sub.teacher_new and sub.teacher_old:
teacher = "<s>{}</s> → <strong>{}</strong>".format(
sub.teacher_old.shortcode if not full else sub.teacher_old.name,
sub.teacher_new.shortcode if not full else sub.teacher_new.name)
elif sub.teacher_new and not sub.teacher_old:
teacher = "<strong>{}</strong>".format(sub.teacher_new.shortcode if not full else sub.teacher_new.name)
else:
teacher = "<strong>{}</strong>".format(sub.teacher_old.shortcode if not full else sub.teacher_old.name)
return teacher
def generate_subject_row(sub, full=False):
if sub.type == 3:
subject = "Aufsicht"
elif sub.type == 1 or sub.type == 2:
subject = "<s>{}</s>".format(sub.subject_old.shortcode if not full else sub.subject_old.name)
elif sub.subject_new and sub.subject_old:
subject = "<s>{}</s> → <strong>{}</strong>".format(
sub.subject_old.shortcode if not full else sub.subject_old.name,
sub.subject_new.shortcode if not full else sub.subject_new.name)
elif sub.subject_new and not sub.subject_old:
subject = "<strong>{}</strong>".format(sub.subject_new.shortcode if not full else sub.subject_new.name)
else:
subject = "<strong>{}</strong>".format(sub.subject_old.shortcode if not full else sub.subject_old.name)
return subject
def generate_room_row(sub, full=False):
room = ""
if sub.type == 3:
room = sub.corridor.name
elif sub.type == 1 or sub.type == 2:
pass
elif sub.room_new and sub.room_old:
room = "<s>{}</s> → <strong>{}</strong>".format(sub.room_old.shortcode if not full else sub.room_old.name,
sub.room_new.shortcode if not full else sub.room_new.name)
elif sub.room_new and not sub.room_old:
room = sub.room_new.shortcode if not full else sub.room_new.name
elif not sub.room_new and not sub.room_old:
pass
else:
room = sub.room_old.shortcode if not full else sub.room_old.name
return room
def generate_sub_table(subs):
sub_rows = []
for sub in subs:
......@@ -167,41 +222,12 @@ def generate_sub_table(subs):
for class_ in sub.classes:
sub_row.classes = class_.name
if sub.type == 1:
sub_row.teacher = "<s>{}</s>".format(sub.teacher_old.shortcode)
elif sub.teacher_new and sub.teacher_old:
sub_row.teacher = "<s>{}</s> → <strong>{}</strong>".format(sub.teacher_old.shortcode,
sub.teacher_new.shortcode)
elif sub.teacher_new and not sub.teacher_old:
sub_row.teacher = "<strong>{}</strong>".format(sub.teacher_new.shortcode)
else:
sub_row.teacher = "<strong>{}</strong>".format(sub.teacher_old.shortcode)
if sub.type == 3:
sub_row.subject = "Aufsicht"
elif sub.type == 1 or sub.type == 2:
sub_row.subject = "<s>{}</s>".format(sub.subject_old.shortcode)
elif sub.subject_new and sub.subject_old:
sub_row.subject = "<s>{}</s> → <strong>{}</strong>".format(sub.subject_old.shortcode,
sub.subject_new.shortcode)
elif sub.subject_new and not sub.subject_old:
sub_row.subject = "<strong>{}</strong>".format(sub.subject_new.shortcode)
else:
sub_row.subject = "<strong>{}</strong>".format(sub.subject_old.shortcode)
if sub.type == 3:
sub_row.room = sub.corridor.name
elif sub.type == 1 or sub.type == 2:
pass
elif sub.room_new and sub.room_old:
sub_row.room = "<s>{}</s> → <strong>{}</strong>".format(sub.room_old.shortcode, sub.room_new.shortcode)
elif sub.room_new and not sub.room_old:
sub_row.room = sub.room_new.shortcode
elif not sub.room_new and not sub.room_old:
pass
else:
sub_row.room = sub.room_old.shortcode
sub_row.teacher = generate_teacher_row(sub)
sub_row.teacher_full = generate_teacher_row(sub, full=True)
sub_row.subject = generate_subject_row(sub)
sub_row.subject_full = generate_subject_row(sub, full=True)
sub_row.room = generate_room_row(sub)
sub_row.room_full = generate_room_row(sub, full=True)
sub_row.text = sub.text
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment