Robin Weichselbraun 03ddeba846 Performance update with HTMLAgilityPack
Added Branches
Added LinksToScrape
Added ScrapedLinks
2024-10-12 17:36:23 +02:00

92 lines
2.5 KiB
Plaintext

@using System.Text.RegularExpressions
@model LecturesViewModel
@{
string GetBranchName(string branch)
{
Regex regex = new Regex(@".* - (.*)");
var match = regex.Match(branch);
if (match.Success)
{
return match.Groups[1].Value;
}
else
{
return branch;
}
}
}
<style>
.time {
display: inline;
}
.time[open] {
display: block;
}
details[open] > summary {
color:blue;
}
details > * {
margin-left: 10px;
}
details > summary {
margin-left: 0;
}
form {
width: 100%;
}
</style>
<form method="get" >
Semester: <input type="text" asp-for="CurrentSemester" style="width:3.5em;text-align:center;" maxlength="5" />
Ort: <input type="text" asp-for="LocationFilter" />
Studiengang:
<select type="text" asp-for="BranchFilter" >
<option value="">Alle</option>
@foreach (var branch in Model.Branches.OrderBy(x => GetBranchName(x)))
{
<option value="@branch">
@GetBranchName(branch)
</option>
}
</select>
<input type="submit" value="Filter" />
</form>
@foreach (var day in Model.LectureEvents.GroupBy(x => x.From.Date).OrderBy(x => x.Key))
{
<details class="day">
<summary>@day.Key.ToString("dd.MM.yyyy") - (@day.Count())</summary>
@foreach (var time in day.GroupBy(x => x.From).OrderBy(x => x.Key))
{
<details class="time">
<summary>@time.Key.ToString("HH:mm") - (@time.Count())</summary>
@foreach (var eventItem in time.OrderBy(x => x.Lecture.Title))
{
<details class="lecture">
<summary class="title">@eventItem.Lecture.Title</summary>
<div class="time">Zeitraum: @eventItem.From.ToString("HH:mm") - @eventItem.To.ToString("HH:mm")</div>
<div class="room">Ort: @eventItem.Location</div>
<a href="@eventItem.Lecture.Url">@eventItem.Lecture.Url</a>
<details>
<summary>Infos</summary>
@Html.Raw(eventItem.Lecture.Description);
</details>
</details>
}
</details>
}
</details>
}