don't show tier under itself. also initial button to add new tier(s)
This commit is contained in:
parent
0d2d4bf11e
commit
2753be8450
|
@ -10,10 +10,11 @@
|
|||
let relpermalink = "";
|
||||
let protocol = "";
|
||||
let title = "Foo bar";
|
||||
let hases = [];
|
||||
let hasesCandidates = [];
|
||||
let frontmatter = {};
|
||||
frontmatter["triad"] = [];
|
||||
let hases = [];
|
||||
let hasesCandidates = [];
|
||||
let frontmatter = {};
|
||||
let frontmatterLoaded = false;
|
||||
frontmatter["triad"] = [];
|
||||
frontmatter["ascriptions"] = [];
|
||||
frontmatter["notsand"] = [];
|
||||
|
||||
|
@ -38,8 +39,8 @@
|
|||
tiers: [],
|
||||
candidates: METASP[newFmKey].tiers,
|
||||
};
|
||||
hasesCandidates = [...hasesCandidates, oldFmKey];
|
||||
hasesCandidates = hasesCandidates.filter((h) => h != newFmKey);
|
||||
hasesCandidates = [...hasesCandidates, oldFmKey];
|
||||
}
|
||||
|
||||
function loadHugoPageMetadata(editHash) {
|
||||
|
@ -53,7 +54,8 @@
|
|||
relpath = repo.path;
|
||||
relpermalink = repo.relpermalink;
|
||||
protocol = document.location.protocol.substring(0, 4);
|
||||
hases = Object.keys(METASP);
|
||||
let notSelf = Object.entries(METASP).filter(n => n[1].singular == relpath.split("/")[0])[0][0]
|
||||
hases = Object.keys(METASP).filter(k => k != notSelf);
|
||||
Object.entries(repo.frontmatter).forEach(([fmKey, fmValue]) => {
|
||||
let fmKeyType = "";
|
||||
if (fmKey.toLowerCase().startsWith("has_")) {
|
||||
|
@ -77,7 +79,7 @@
|
|||
if (fmValue.includes(t.file)) {
|
||||
tiers.push(t);
|
||||
} else {
|
||||
candidates.push(t);
|
||||
candidates.push(t);
|
||||
}
|
||||
});
|
||||
frontmatter[fmKeyType].push({
|
||||
|
@ -108,6 +110,7 @@
|
|||
|
||||
let tkey = Object.keys(repo.frontmatter).filter((t) => t.toLowerCase() == "title")[0];
|
||||
title = repo.frontmatter[tkey];
|
||||
frontmatterLoaded = true;
|
||||
};
|
||||
el.src = `../js/repo/${editHash}.js`;
|
||||
document.body.appendChild(el);
|
||||
|
@ -156,10 +159,13 @@
|
|||
return Object.entries(frontmatter).filter(val => val[1].length == 0).map(key => key[0])
|
||||
}
|
||||
|
||||
function checkTriad() {
|
||||
let ct = Object.entries(frontmatter).filter(i => i[1].length == 0 && i[0] == "triad")
|
||||
return ct.length == 0 ? false : true
|
||||
}
|
||||
|
||||
function newTriad() {
|
||||
let t = {}
|
||||
t["detail"] = ["triad", 0, "authors", "editors"]
|
||||
newHasTiers(t)
|
||||
newHasTiers({"detail": ["triad", 0, "authors", "editors"]})
|
||||
}
|
||||
|
||||
function dispatchHash() {
|
||||
|
@ -218,11 +224,9 @@
|
|||
{/if}
|
||||
{/each}
|
||||
{/each}
|
||||
{#each newFrontmatter() as nf}
|
||||
{#if nf == "triad"}
|
||||
<div on:click="{newTriad}">NEW TRIAD TIER</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{#if frontmatterLoaded && checkTriad()}
|
||||
<div on:click="{newTriad}">NEW TRIAD TIER</div>
|
||||
{/if}
|
||||
</span>
|
||||
<div class="formgrid">
|
||||
<label for="pagecontent">Content:</label>
|
||||
|
|
Loading…
Reference in New Issue