code-style: centralize CSS styling into stylesheet file

This commit is contained in:
Johannes 2023-07-09 13:01:01 +02:00
parent 4d7d98feed
commit 608a570e6c
5 changed files with 13 additions and 23 deletions

View file

@ -55,9 +55,9 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity { for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {
tableBody += "<tr>" tableBody += "<tr>"
if minute == 0 { if minute == 0 {
tableBody += fmt.Sprintf("<td>%d Uhr</td>\n", hour) tableBody += fmt.Sprintf("<td class=\"timetableRightBorder\">%d Uhr</td>\n", hour)
} else { } else {
tableBody += "<td></td>\n" tableBody += "<td class=\"timetableRightBorder\"></td>\n"
} }
for day := 0; day < 5; day += 1 { for day := 0; day < 5; day += 1 {
for slot := 0; slot < slots[day]; slot += 1 { for slot := 0; slot < slots[day]; slot += 1 {
@ -96,7 +96,7 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
} }
} else { } else {
if slot+1 == slots[day] { if slot+1 == slots[day] {
tableBody += "<td style=\"border-right: 1px dotted\"></td>\n" tableBody += "<td class=\"timetableRightBorder\"></td>\n"
} else { } else {
tableBody += "<td></td>\n" tableBody += "<td></td>\n"
} }

View file

@ -14,17 +14,6 @@
{{end}} {{end}}
</div> </div>
<style>
input.required ~ label::after, select.required ~ label::after {
content: ' *';
color: red;
}
.form-control ~ .form-text {
padding-left: 12px;
padding-right: 12px;
}
</style>
<div class="row"> <div class="row">
<div class="col-lg-8 mb-4"> <div class="col-lg-8 mb-4">
<form method="POST" action="addOfficeHour"> <form method="POST" action="addOfficeHour">

View file

@ -6,7 +6,8 @@
<meta name="description" content="Eine Übersicht der Sprechstunden, die in den offenen Arbeitsräumen der Fachschaft Mathematik, TU Darmstadt, angeboten werden"> <meta name="description" content="Eine Übersicht der Sprechstunden, die in den offenen Arbeitsräumen der Fachschaft Mathematik, TU Darmstadt, angeboten werden">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="/static/officeHours.css" />
<title>{{block "title" .}}Start{{end}} Sprechstunden</title> <title>{{block "title" .}}Start{{end}} Sprechstunden</title>
</head> </head>

View file

@ -1,11 +1,11 @@
<table> <table>
<tr> <tr>
<th>&nbsp;</th> <th class="px-2 text-center timetableRightBorder">&nbsp;</th>
<th colspan="{{.ColspanMon}}" style="padding-left: 10px; padding-right: 10px; border-right: 1px dotted">Montag</th> <th class="px-2 text-center timetableRightBorder" colspan="{{.ColspanMon}}">Montag</th>
<th colspan="{{.ColspanTue}}" style="padding-left: 10px; padding-right: 10px; border-right: 1px dotted">Dienstag</th> <th class="px-2 text-center timetableRightBorder" colspan="{{.ColspanTue}}">Dienstag</th>
<th colspan="{{.ColspanWed}}" style="padding-left: 10px; padding-right: 10px; border-right: 1px dotted">Mittwoch</th> <th class="px-2 text-center timetableRightBorder" colspan="{{.ColspanWed}}">Mittwoch</th>
<th colspan="{{.ColspanThu}}" style="padding-left: 10px; padding-right: 10px; border-right: 1px dotted">Donnerstag</th> <th class="px-2 text-center timetableRightBorder" colspan="{{.ColspanThu}}">Donnerstag</th>
<th colspan="{{.ColspanFri}}" style="padding-left: 10px; padding-right: 10px; border-right: 1px dotted">Freitag</th> <th class="px-2 text-center timetableRightBorder" colspan="{{.ColspanFri}}">Freitag</th>
</tr> </tr>
{{.TableBody}} {{.TableBody}}
</table> </table>

View file

@ -1,4 +1,4 @@
<td rowspan="{{divide .OfficeHour.Duration .MinuteGranularity}}" style="border: 1px solid"> <td class="officeHour" rowspan="{{divide .OfficeHour.Duration .MinuteGranularity}}">
{{if .DeleteIcons}}<div style="text-align: right;"><a href="/deleteOfficeHour?id={{.OfficeHour.Id}}"></a></div>{{end}} {{if .DeleteIcons}}<div style="text-align: right;"><a href="/deleteOfficeHour?id={{.OfficeHour.Id}}"></a></div>{{end}}
{{printf "%02d" .OfficeHour.Date.Hour}}:{{printf "%02d" .OfficeHour.Date.Minute}} - {{printf "%02d" .OfficeHour.EndDate.Hour}}:{{printf "%02d" .OfficeHour.EndDate.Minute}}<br> {{printf "%02d" .OfficeHour.Date.Hour}}:{{printf "%02d" .OfficeHour.Date.Minute}} - {{printf "%02d" .OfficeHour.EndDate.Hour}}:{{printf "%02d" .OfficeHour.EndDate.Minute}}<br>
{{if eq .OfficeHour.Date.Week 1}}in ungeraden Vorlesungswochen<br>{{end}}{{if eq .OfficeHour.Date.Week 2}}in geraden Vorlesungswochen<br>{{end}} {{if eq .OfficeHour.Date.Week 1}}in ungeraden Vorlesungswochen<br>{{end}}{{if eq .OfficeHour.Date.Week 2}}in geraden Vorlesungswochen<br>{{end}}