Automatische Erstellung der Navigation

master
Peter Fischer 2020-04-18 10:21:44 +02:00
parent 22ec169375
commit ba6481bca5
19 changed files with 250 additions and 88 deletions

View File

@ -7,6 +7,97 @@ var pathoffset = 'nt/ev/mk/';
var _locals = { pathoffset : "/nt/ev/mk" }; var _locals = { pathoffset : "/nt/ev/mk" };
var _gliederung =
[
{
id : "gliederung",
name: "Gliederung",
subs: [
{
id : "index",
name: "Übersicht",
subs: []
},
{
id : "anfang",
name: "Anfang ...",
subs: []
},
{
id : "IIa_konzentr",
name: "IIA Konzentrisch",
subs: []
},
{
id : "IIa_wegbereiter",
name: "IIA Wegbereiter",
subs: []
},
{
id : "IIb_konzentr",
name: "IIB Konzentrisch",
subs: []
},
{
id : "IIb_konzentr_ablehnung",
name: "IIB Konzentrisch <q>Ablehnung</q>",
subs: []
},
{
id : "IIb_konzentr_sendung",
name: "IIB Konzentrisch <q>Sendung</q>",
subs: []
},
{
id : "IIb_konzentr_hirte",
name: "IIB Konzentrisch <q>Hirte</q>",
subs: []
},
{
id : "IIc_konzentr",
name: "IIC Konzentrisch",
subs: []
},
{
id : "IIIa",
name: "IIIA",
subs: []
},
{
id : "IIIa_gesplittet",
name: "IIIA gesplittet",
subs: []
},
{
id : "IIIa_falsch_richtig",
name: "IIIA <q>Falsch Richtig</q>",
subs: []
},
{
id : "III_sohn",
name: "III <q>Sohn</q>",
subs: []
},
{
id : "auf_dem_weg_konzentr",
name: "Auf dem Weg Konzentrisch",
subs: []
},
{
id : "auf_dem_weg_konzentr2",
name: "Auf dem Weg Konzentrisch 2",
subs: []
},
{
id : "IIIc_tempel_frucht",
name: "IIIC <q>Tempel Frucht</q>",
subs: []
}
]
},
];
function get_locals(req) { function get_locals(req) {
var locals = _locals; var locals = _locals;
locals.as_presentation = req.session.as_presentation; locals.as_presentation = req.session.as_presentation;
@ -17,16 +108,53 @@ function get_locals(req) {
} }
router.get('/', function(req, res, next) { router.get('/', function(req, res, next) {
var params = get_locals(req);
params.gliederung = _gliederung;
res.render(pathoffset+'index', get_locals(req)); res.render(pathoffset+'index', get_locals(req));
}); });
router.get('/gliederung', function(req,res,next) { router.get('/:layer1', function(req, res, next) {
var layer1 = _gliederung.find(elem => elem.id === req.params.layer1);
console.log(layer1);
if(layer1.subs.length === 0)
console.log('ERROR layer1.subs.length === 0');
var index = layer1.subs[0];
var params = get_locals(req);
params.gliederung = _gliederung;
params.current = [];
params.current.push(layer1);
params.current.push(index);
console.log(params);
res.render(pathoffset + req.params.layer1+"/"+index.id, params);
});
router.get('/:layer1/:layer2', function(req, res, next) {
var layer1 = _gliederung.find(elem => elem.id === req.params.layer1);
console.log(layer1);
var layer2 = layer1.subs.find(elem => elem.id === req.params.layer2);
console.log(layer2);
var params = get_locals(req);
params.gliederung = _gliederung;
params.current = [];
params.current.push(layer1);
params.current.push(layer2);
console.log(params);
res.render(pathoffset + req.params.layer1+"/"+layer2.id, params);
});
/*router.get('/gliederung', function(req,res,next) {
res.render(pathoffset+'gliederung/index', get_locals(req)); res.render(pathoffset+'gliederung/index', get_locals(req));
}); });
router.get('/gliederung/:target', function(req,res,next) { router.get('/gliederung/:target', function(req,res,next) {
res.render(pathoffset+'gliederung/' + req.params.target, get_locals(req)); res.render(pathoffset+'gliederung/' + req.params.target, get_locals(req));
}); });*/
/* XXX */
/*router.get('/entstehung', function(req,res,next) { /*router.get('/entstehung', function(req,res,next) {
res.render(pathoffset+'entstehung/quellen', get_locals(req)); res.render(pathoffset+'entstehung/quellen', get_locals(req));

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span III <q>Sohn</q>
block content block content
@ -138,4 +136,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("III_sohn") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIIA
block content block content
@ -816,4 +814,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIIa") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIIA <q>Falsch Richtig</q>
block content block content
@ -151,4 +149,4 @@ block content
| Verfluchung/Verdorren des Feigenbaumes als Symbol für Unfruchtbarkeit und <q>Tod</q> des Tempels. | Verfluchung/Verdorren des Feigenbaumes als Symbol für Unfruchtbarkeit und <q>Tod</q> des Tempels.
block bottomnav block bottomnav
+bottom_gliederung("IIIa_falsch_richtig") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIIA Gesplittet
block content block content
@ -563,4 +561,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIIa_gesplittet") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIIC <q>Tempel Frucht</q>
block content block content
@ -239,4 +237,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIIc_tempel_frucht") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIA Konzentrisch
block content block content
.card.konzentr-8.mb-2 .card.konzentr-8.mb-2
@ -103,4 +101,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIa_konzentr") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIA Wegbereiter
block content block content
@ -576,4 +574,4 @@ block content
| Konflikt mit den Pharisäern | Konflikt mit den Pharisäern
block bottomnav block bottomnav
+bottom_gliederung("IIa_wegbereiter") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIB Konzentrisch
block content block content
@ -130,4 +128,4 @@ block content
| Unverständige Jünger | Unverständige Jünger
block bottomnav block bottomnav
+bottom_gliederung("IIb_konzentr") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIB Konzentrisch <q>Ablehnung</q>
block content block content
.card.konzentr-6.mb-2 .card.konzentr-6.mb-2
@ -62,4 +60,4 @@ block content
h6.card-subtitle.text-muted.bibelstelle Mk 6,45-52 h6.card-subtitle.text-muted.bibelstelle Mk 6,45-52
block bottomnav block bottomnav
+bottom_gliederung("IIb_konzentr_ablehnung") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIB Konzentrisch <q>Hirte</q>
block content block content
.card.konzentr-4.mb-2 .card.konzentr-4.mb-2
@ -58,4 +56,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIb_konzentr_hirte") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIB Konzentrisch <q>Sendung</q>
block content block content
.card.konzentr-6.mb-2 .card.konzentr-6.mb-2
@ -57,4 +55,4 @@ block content
h6.card-subtitle.text-muted.bibelstelle Mk 6,17-29 h6.card-subtitle.text-muted.bibelstelle Mk 6,17-29
block bottomnav block bottomnav
+bottom_gliederung("IIb_konzentr_sendung") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span IIC Konzentrisch
block content block content
.card.konzentr-7.mb-2 .card.konzentr-7.mb-2
@ -84,4 +82,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("IIc_konzentr") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span Anfang ...
block content block content
@ -634,4 +632,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("anfang") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span Auf dem Weg Konzentrisch
block content block content
@ -112,4 +110,4 @@ block content
block bottomnav block bottomnav
+bottom_gliederung("auf_dem_weg_konzentr") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span Auf dem Weg Konzentrisch 2
block content block content
.viewbox.konzentr-8 .viewbox.konzentr-8
@ -257,4 +255,4 @@ block content
| Wie Christus, der Menschensohn, dienen: <q>Denn auch der Menschensohn ...</q> | Wie Christus, der Menschensohn, dienen: <q>Denn auch der Menschensohn ...</q>
block bottomnav block bottomnav
+bottom_gliederung("auf_dem_weg_konzentr2") +bottom_autonav(gliederung, current)

View File

@ -3,9 +3,7 @@ include ../mixins
block headline block headline
+headline +headline
+headline_item_gliederung +navigation_auto(gliederung, current)
+headline_item_active
span Übersicht
block content block content
@ -589,4 +587,4 @@ block content
p.card-text.small p.card-text.small
i Vom <q>Zurückweisen</q> zum <q>Herrufen</q>. i Vom <q>Zurückweisen</q> zum <q>Herrufen</q>.
block bottomnav block bottomnav
+bottom_gliederung("index") +bottom_autonav(gliederung, current)

View File

@ -3,8 +3,15 @@ include mixins
block headline block headline
+headline +headline
+headline_item_active ol.breadcrumb(onclick="show_all_slides();", style="margin-top: .5rem; border-radius: 0;")
span Start .h1(style="margin-bottom: 0px; color: #0e4f88; width: 100%;") Start&nbsp;
span.small.dropdown
a.dropdown-toggle(data-toggle="dropdown", href="#", style="margin-bottom: 0px; color: #0e4f88; width: 100%;")
.dropdown-menu
a.dropdown-item(href="#")
b Start
each sub in gliederung
a.dropdown-item(href=pathoffset + "/" + sub.id) !{sub.name}
block content block content
@ -56,9 +63,13 @@ block content
p p
| Dies alles zeigt, dass man sich zunächst mit der <a href="#{pathoffset}/gliederung">Gliederung des Evangeliums</a> vertraut machen sollte. | Dies alles zeigt, dass man sich zunächst mit der <a href="#{pathoffset}/gliederung">Gliederung des Evangeliums</a> vertraut machen sollte.
block bottomnav block bottomnav
+bottom_nav("start") hr(style="margin-top: 2rem; border-top-width: 7px; border-top-color: #a4d0fd;")
ul.nav.nav-fill.nav-pills(style="padding-left: 1rem; padding-right: 1rem;")
li.nav-item
a.nav-link.active(href="#") Start
each item in gliederung
- var my_fullpath = pathoffset + "/" + item.id;
li.nav-item
a.nav-link(href=my_fullpath) !{item.name}

View File

@ -16,21 +16,76 @@ mixin headline
a(href="http://www.halieus.de/impressum_datenschutz.html" target="_blank") Impressum &amp; Datenschutzerklärung a(href="http://www.halieus.de/impressum_datenschutz.html" target="_blank") Impressum &amp; Datenschutzerklärung
p(style="font-size: 130%; font-variant: small-caps; margin-bottom: 0px;") p(style="font-size: 130%; font-variant: small-caps; margin-bottom: 0px;")
b Einführung in das Evangelium nach Markus b Einführung in das Evangelium nach Markus
ol.breadcrumb(onclick="show_all_slides();", style="margin-top: .5rem; border-radius: 0;")
block
mixin headline_item_start mixin navigation_auto(gliederung, current)
ol.breadcrumb(onclick="show_all_slides();", style="margin-top: .5rem; border-radius: 0;")
li.breadcrumb-item li.breadcrumb-item
a(href=pathoffset+"/") Start a(href=pathoffset+"/") Start
- var nr_items = current.length;
mixin headline_item_gliederung - var cnt = 0;
- var subs = gliederung;
- var fullpath = pathoffset;
- var old_fullpath;
each item in current
- cnt = cnt+1;
- old_fullpath = fullpath;
- fullpath = fullpath + "/" + item.id;
if(cnt != nr_items)
li.breadcrumb-item li.breadcrumb-item
a(href=pathoffset+"/gliederung") Gliederung a(href=fullpath) !{item.name}
if(subs.length > 1)
mixin headline_item_active each sub in subs
if(sub.id != item.id)
div #{sub.name}
else
li.breadcrumb-item li.breadcrumb-item
.h1(style="margin-bottom: 0px; color: #0e4f88; width: 100%;") .h1(style="margin-bottom: 0px; color: #0e4f88; width: 100%;") !{item.name}&nbsp;
block if(subs.length > 1)
span.small.dropdown
a.dropdown-toggle(data-toggle="dropdown", href="#", style="margin-bottom: 0px; color: #0e4f88; width: 100%;")
.dropdown-menu
each sub in subs
a.dropdown-item(href=old_fullpath + "/" + sub.id)
if(sub.id === item.id)
b !{sub.name}
else
span !{sub.name}
- subs = item.subs;
mixin bottom_autonav(gliederung, current)
hr(style="margin-top: 2rem; border-top-width: 7px; border-top-color: #a4d0fd;")
ul.nav.nav-fill.nav-pills(style="padding-left: 1rem; padding-right: 1rem;")
li.nav-item
a.nav-link(href=pathoffset+"/") Start
- var nr_items = current.length;
- var fullpath = pathoffset;
each item in gliederung
- var my_fullpath = fullpath + "/" + item.id;
if(item.id === current[0].id)
li.nav-item
a.nav-link.active !{item.name}
else
li.nav-item
a.nav-link(href=my_fullpath) !{item.name}
if(nr_items > 1)
hr(style="border-top-width: 5px; border-top-color: #a4d0fd")
.small(style="margin-top: 3px;")
ul.nav.nav-fill.nav-pills.pill-sub-1
- fullpath = fullpath + "/" + current[0].id;
each item in current[0].subs
- var my_fullpath = fullpath + "/" + item.id;
if(item.id === current[1].id)
li.nav-item
a.nav-link.active !{item.name}
else
li.nav-item
a.nav-link(href=my_fullpath) !{item.name}
mixin bottom_nav_item(active, short, href, name) mixin bottom_nav_item(active, short, href, name)
if(active===short) if(active===short)