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 _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) {
var locals = _locals;
locals.as_presentation = req.session.as_presentation;
@ -17,16 +108,53 @@ function get_locals(req) {
}
router.get('/', function(req, res, next) {
var params = get_locals(req);
params.gliederung = _gliederung;
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));
});
router.get('/gliederung/:target', function(req,res,next) {
res.render(pathoffset+'gliederung/' + req.params.target, get_locals(req));
});
});*/
/* XXX */
/*router.get('/entstehung', function(req,res,next) {
res.render(pathoffset+'entstehung/quellen', get_locals(req));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,8 +3,15 @@ include mixins
block headline
+headline
+headline_item_active
span Start
ol.breadcrumb(onclick="show_all_slides();", style="margin-top: .5rem; border-radius: 0;")
.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
@ -55,10 +62,14 @@ block content
p
| Dies alles zeigt, dass man sich zunächst mit der <a href="#{pathoffset}/gliederung">Gliederung des Evangeliums</a> vertraut machen sollte.
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

@ -4,7 +4,7 @@ mixin footnote(content)
mixin symbol(s)
span.oi(class="oi-"+s)
span &nbsp;
mixin headline
div(style="margin-top: 15px; padding-left: 1rem; padding-right: 1rem;")
table(style="font-size: 80%; font-variant: small-caps; margin-bottom: 0px; width: 100%;")
@ -16,21 +16,76 @@ mixin headline
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;")
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
li.breadcrumb-item
a(href=pathoffset+"/") Start
mixin headline_item_gliederung
li.breadcrumb-item
a(href=pathoffset+"/gliederung") Gliederung
mixin navigation_auto(gliederung, current)
ol.breadcrumb(onclick="show_all_slides();", style="margin-top: .5rem; border-radius: 0;")
li.breadcrumb-item
a(href=pathoffset+"/") Start
- var nr_items = current.length;
- 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
a(href=fullpath) !{item.name}
if(subs.length > 1)
each sub in subs
if(sub.id != item.id)
div #{sub.name}
else
li.breadcrumb-item
.h1(style="margin-bottom: 0px; color: #0e4f88; width: 100%;") !{item.name}&nbsp;
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}
mixin headline_item_active
li.breadcrumb-item
.h1(style="margin-bottom: 0px; color: #0e4f88; width: 100%;")
block
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)
if(active===short)