Merge remote-tracking branch 'origin/main' into styling

This commit is contained in:
Johannes 2022-09-22 13:15:17 +02:00
commit 961a10915b
13 changed files with 193 additions and 74 deletions

View file

@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"html/template"
"log"
"officeHours/models"
)
@ -84,7 +85,10 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
MinuteGranularity int
DeleteIcons bool
}{OfficeHour: current, MinuteGranularity: b.config.Date.MinuteGranularity, DeleteIcons: deleteIcons}
RawTemplates.ExecuteTemplate(&celldata, "td.html", data)
templateError := RawTemplates.ExecuteTemplate(&celldata, "td.html", data)
if templateError != nil {
log.Printf("Error executing template td.html: %s", templateError.Error())
}
tableBody += celldata.String()
}
} else {
@ -116,6 +120,9 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
slots[4],
template.HTML(tableBody),
}
RawTemplates.ExecuteTemplate(&table, "officeHourTable.html", tableData)
templateError := RawTemplates.ExecuteTemplate(&table, "officeHourTable.html", tableData)
if templateError != nil {
log.Printf("Error executing template officeHourTable.html: %s", templateError.Error())
}
return template.HTML(table.String())
}