Skip to content

Commit

Permalink
Improve format of the output
Browse files Browse the repository at this point in the history
For non-html clients we now also use the URL field which allows
them to at least get an URL to the map and for html clients some
fields are renamed to something better.
  • Loading branch information
flofriday committed Dec 15, 2023
1 parent 6779e29 commit 70de68b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 14 additions & 10 deletions app/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ class Event:
floor: str = ""
tiss_url: str = ""
room_url: str = ""
map_url: str = ""

def plain_description_en(self) -> str:
text = ""

if self.shorthand != "":
text += f"{self.name}\n"

text += f"Room: {self.room}\n"
if self.floor != "":
text += f"Floor: {self.floor}\n"
Expand All @@ -40,13 +42,13 @@ def html_description_en(self) -> str:
if self.shorthand != "":
text += f"<b>{html.escape(self.name)}</b><br>"

text += f'Details: <a href="{self.tiss_url}">TISS</a>'
if self.room_code != "":
text += f', <a href="https://tuw-maps.tuwien.ac.at/?q={self.room_code}#map">TUW-Maps</a>'
text += f'Details: <a href="{self.tiss_url}">Lecture</a>'
if self.room_url != "":
text += f', <a href="{self.room_url}">Room-Schedule</a>'
text += "<br>"

if self.room_url != "":
text += f'Room: <a href="{self.room_url}">{self.room}</a><br>'
if self.map_url != "":
text += f'Room: <a href="{self.map_url}">{self.room}</a><br>'
else:
text += f"Room: {self.room}<br>"

Expand Down Expand Up @@ -75,13 +77,13 @@ def html_description_de(self) -> str:
if self.shorthand != "":
text += f"<b>{html.escape(self.name)}</b><br>"

text += f'Details: <a href="{self.tiss_url}">TISS</a>'
if self.room_code != "":
text += f', <a href="https://tuw-maps.tuwien.ac.at/?q={self.room_code}#map">TUW-Maps</a>'
text += f'Details: <a href="{self.tiss_url}">LVA</a>'
if self.room_url != "":
text += f', <a href="{self.room_url}">Raum Reservierung</a>'
text += "<br>"

if self.room_url != "":
text += f'Raum: <a href="{self.room_url}">{self.room}</a><br>'
if self.map_url != "":
text += f'Raum: <a href="{self.map_url}">{self.room}</a><br>'
else:
text += f"Raum: {self.room}<br>"

Expand Down Expand Up @@ -148,6 +150,7 @@ def improve_calendar(
component.add("description", html_description)
else:
component.add("description", plain_description)
component.add("url", event.map_url)

component.add("x-alt-desc;fmttype=text/html", html_description)

Expand Down Expand Up @@ -220,6 +223,7 @@ def add_location(event: Event) -> Event:
event.floor = floor
event.room_code = code
event.room_url = url
event.map_url = (f"https://tuw-maps.tuwien.ac.at/?q={code}#map",)
return event


Expand Down
12 changes: 4 additions & 8 deletions app/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

<body class="h-screen">
<div class="h-full flex flex-col justify-between">
<main class="container w-full max-w-[30rem] mx-auto px-4 text-center">
<h1 class="text-6xl font-bold pt-12 pb-6 leading-snug">
Better TISS Calendar
</h1>
<main class="container w-full max-w-[32rem] mx-auto px-4 text-center"> <h1 class="text-6xl font-bold pt-12 pb-6 leading-snug"> Better TISS Calendar </h1>
<div class="flex flex-row justify-around mb-12">
<div class="my-auto w-[12rem] h-full border border-[color:#666] rounded-2xl text-start p-3">
<div lang="de" class="text-lg font-bold">183.579 VU Technische Grundlagen der
Expand All @@ -37,8 +34,7 @@ <h1 class="text-6xl font-bold pt-12 pb-6 leading-snug">
<div lang="de" class="my-1 text-xs">Vorlesung</div>
</div>
<span aria-hidden="true" class="my-auto text-5xl px-2 whitespace-nowrap"></span>
<div class="w-[12rem] h-full rounded-2xl p-[1px] bg-gradient-to-r from-pink-500 to-yellow-500">
<div class="w-full h-full bg-black rounded-2xl text-start p-3">
<div class="w-[12rem] w-min-[12rem] h-full rounded-2xl p-[1px] bg-gradient-to-r from-pink-500 to-yellow-500"> <div class="w-full h-full bg-black rounded-2xl text-start p-3">
<div lang="de" id="preview-title" class="text-lg font-bold">TGI VU</div>
<div lang="de" class="my-2 text-sm">Getreidemarkt 9</div>
<div class="my-1 text-sm">
Expand All @@ -47,8 +43,8 @@ <h1 class="text-6xl font-bold pt-12 pb-6 leading-snug">
Informatik</strong>
</div>
<div class="mb-1">
Details: <span lang="de" class="text-blue-400">TISS</span>, <span lang="de"
class="text-blue-400">TUW-Maps</span>
Details: <span lang="de" class="text-blue-400">Lecture</span>, <span lang="de"
class="text-blue-400">Room Reservation</span>
</div>
<div class="mb-1">
Room: <span lang="de" class="text-blue-400">GM 1 Audi. Max.-
Expand Down

0 comments on commit 70de68b

Please sign in to comment.