Added settings classes for CSS; added Register parsing

This commit is contained in:
schnulller
2022-05-18 04:38:57 +02:00
parent 2ffd46cd62
commit f1743fcf39
14 changed files with 882 additions and 258 deletions

View File

@@ -1,11 +1,56 @@
@model RegisterViewModel;
@using System.Diagnostics;
@foreach (var k in Model.Comments) {
<div>@Html.Raw(k.ParsedComment)</div>
@if (k.SubComments != null ) {
@foreach (var sk in k.SubComments) {
<div>@Html.Raw(sk.ParsedComment)</div>
@* Generated classes by CommentHelper.cs:
- .ha-letlink .ha-wwwlink .ha-reflink: Links to letters, the web, the reference
- .ha-lemma: The lemma
- .ha-title: Name of something
- .ha-reference: Automatically inserted linktext
- .ha-commenthead: Class containing the head of a comment, lemma and backlinks
- .ha-commentbody: Body of a comment, containing the comments text
- .ha-letlinks: Collection of references in the comment within the marginals
- .ha-insertedlemma: automatically generated and inserted lemma
*@
@{
var commentClass = Model.Category == "neuzeit" ? "ha-neuzeit"
: Model.Category == "forschung" ? "ha-forschung"
: "ha-bibel";
}
<div class="ha-register">
<div class="@commentClass">
<div class="ha-register-head">
<h1>@Model.Title</h1>
<div class="ha-register-nav" id="ha-register-nav">
<div class="ha-register-left-nav">
@if (Model.AvailableCategories != null) {
@foreach (var l in Model.AvailableCategories) {
<a href="@l.Item2">@l.Item1</a>
}
}
</div>
<div class="ha-register-right-nav">
@if (Model.AvailableSideCategories != null) {
foreach (var l in Model.AvailableSideCategories) {
<a href="@l.Item2">@l.Item1</a>
}
}
</div>
</div>
</div>
<div class="ha-register-body">
@foreach (var k in Model.ParsedComments) {
<div class="ha-comment">
<div class="ha-headcomment">@Html.Raw(k.ParsedComment)</div>
@if (k.ParsedSubComments != null ) {
@foreach (var sk in k.ParsedSubComments) {
<div class="ha-subcomment">@Html.Raw(sk)</div>
}
}
</div>
}
}
}
</div>
</div>
</div>

View File

@@ -66,43 +66,4 @@
<a href="/Edition/Mitwirkende">Hg. v. Leonard Keidel und Janina Reibold, auf Grundlage der Vorarbeiten Arthur Henkels, unter Mitarbeit von G. Babelotzky, K. Bucher, Ch. Großmann, C.F. Haak, L. Klopfer, J. Knüchel, I. Langkabel und S. Martens (Heidelberg 2020ff.)</a>
</div>
}
</header>
<script>
const _openmenu = function () {
var x = document.getElementById("ha-topnav");
if (x !== null) x.className += " ha-topnav-collapsed";
let oldbutton = document.getElementById("openmenubutton");
if (oldbutton !== null) oldbutton.setAttribute('class', 'hidden');
let newbutton = document.getElementById("closemenubutton");
if (newbutton !== null) newbutton.setAttribute('class', '');
}
const _closemenu = function () {
var x = document.getElementById("ha-topnav");
if (x !== null) x.className = "ha-topnav";
let oldbutton = document.getElementById("closemenubutton");
if (oldbutton !== null) oldbutton.setAttribute('class', 'hidden');
let newbutton = document.getElementById("openmenubutton");
if (newbutton !== null) newbutton.setAttribute('class', '');
}
const _markactive = function (element) {
// Marks links as active which target URL starts with the current URL
var all_links = element.getElementsByTagName("a"),
i = 0, len = all_links.length,
full_path = location.href.split('#')[0].toLowerCase(); //Ignore hashes
for (; i < len; i++) {
if (full_path.startsWith(all_links[i].href.toLowerCase())) {
console.log(all_links[i].href.split("#")[0]);
all_links[i].className += " active";
}
}
}
document.getElementById("openmenubutton").addEventListener('click', _openmenu);
document.getElementById("closemenubutton").addEventListener('click', _closemenu);
_markactive(document.getElementById("ha-topnav"));
</script>
</header>