Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: navigation overhaul
Browse files Browse the repository at this point in the history
* Side navigation: "structure" hierarchy / display pouches only
* Breadcrumb: "schema" hierarchy / don't display pouches
  • Loading branch information
vhf committed Dec 4, 2019
1 parent c7f5bd8 commit a613af6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
16 changes: 10 additions & 6 deletions components/fallback/ObjectDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ export default {
.map((quad) => term(quad.object))
},
isClass () {
return this.$termIRI.ClassLikes
return Boolean(this.$termIRI.ClassLikes
.filter(iri =>
Boolean(this.ontology.match(this.iri, this.$termIRI.a, rdf.namedNode(iri)).toArray().length
)).length
)).length)
},
isProperty () {
return Boolean(this.ontology.match(this.iri, this.$termIRI.a, this.$termIRI.Property).toArray().length)
Expand All @@ -260,14 +260,16 @@ export default {
const parents = this.findPropertyParents(this.iri)
return parents.map((parent) => {
const path = []
let child = this.findInTree(parent.iri, structureTree[0])
let child = this.findInTree(parent.iri, { children: structureTree })
if (!child) {
return ''
}
while (child.parent) {
const label = this.label(rdf.namedNode(child.iri), this.bothDatasets)
const target = this.$rebaseIRI(child.iri)
path.push({ label, target })
if (!child.isCreativeWork) {
path.push({ label, target })
}
child = child.parent
}
path.reverse()
Expand All @@ -276,14 +278,16 @@ export default {
}
else if (this.isClass) {
const path = []
let child = this.findInTree(this.iri.value, structureTree[0])
let child = this.findInTree(this.iri.value, { children: structureTree })
if (!child) {
return ''
}
while (child.parent) {
const label = this.label(rdf.namedNode(child.iri), this.bothDatasets)
const target = this.$rebaseIRI(child.iri)
path.push({ label, target })
if (!child.isCreativeWork) {
path.push({ label, target })
}
child = child.parent
}
path.reverse()
Expand Down
18 changes: 9 additions & 9 deletions components/fallback/sidenav/ObjectNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span
v-if="couldHaveChildren">
<span
v-if="tree.children && tree.children.length"
v-if="children && children.length"
class="icon is-small"
@click.prevent="toggleCollapse">
<minus v-show="showMinusSymbol" />
Expand All @@ -26,22 +26,19 @@
@click.prevent="">
<plus />
</span>
<span v-if="tree.isCreativeWork">
<span>
{{ tree.label || $getTerm(tree.iri) }}
</span>
<span v-else>
{{ $getTerm(tree.iri) || tree.label }}
</span>
</nuxt-link>

<ul
v-if="tree.children && tree.children.length"
v-if="children && children.length"
v-show="isActive">
<object-node
v-for="node in tree.children"
v-for="node in children"
:key="node.iri"
:tree="node"
:could-have-children="!!tree.children.find((node) => node.children.length > 0)"
:could-have-children="!!children.find((node) => node.children.length > 0)"
:current-iri="currentIri" />
</ul>
<div v-else>
Expand Down Expand Up @@ -96,8 +93,11 @@ export default {
}
},
computed: {
children () {
return this.tree.children.filter((node) => node.isCreativeWork)
},
hasActiveChild () {
const childClasses = !!this.tree.children.find((node) => node.iri === this.currentIri)
const childClasses = !!this.children.find((node) => node.iri === this.currentIri)
if (childClasses) {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion components/fallback/sidenav/ObjectTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ul
class="menu-list">
<object-node
v-for="node in tree.children"
v-for="node in tree.children.filter((node) => node.isCreativeWork)"
:key="node.iri"
:tree="node"
:could-have-children="true"
Expand Down

0 comments on commit a613af6

Please sign in to comment.