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