Updated documentation to new parenting format

This commit is contained in:
Thaum Rystra
2024-05-28 13:05:19 +02:00
parent 772e55ece5
commit b98a8b1ddf
12 changed files with 570 additions and 574 deletions

View File

@@ -6,6 +6,8 @@
</template>
<script lang="js">
import Docs from '/imports/api/docs/Docs';
import { getFilter } from '/imports/api/parenting/parentingFunctions';
export default {
props: {
@@ -17,24 +19,27 @@ export default {
computed: {
items() {
const items = [{
text: 'Home',
text: 'Docs',
to: '/docs',
exact: true,
}];
if (!this.doc?.ancestors) return items;
const address = ['/docs']
this.doc.ancestors?.forEach(a => {
address.push(a.urlName);
if (!this.doc) return items;
const ancestors = Docs.find({
...getFilter.ancestors(this.doc)
}).fetch();
ancestors.forEach(a => {
items.push({
text: a.name,
to: address.join('/'),
to: a.href,
exact: true,
});
});
address.push(this.doc.urlName);
items.push({
text: this.doc.name,
to: address.join('/'),
to: this.doc.href,
exact: true,
});
return items;

View File

@@ -183,7 +183,7 @@ export default {
parentId: this.docId,
}, ack);
},
remove({ ack } = {}) {
remove({ ack }) {
const _id = this.docId;
const docName = this.doc.name;
let parentHref = '/docs';

View File

@@ -10,20 +10,18 @@
:children="docs"
:organize="true"
:selected-node="undefined"
:root="{collection: 'docs', id: 'DDDDDDDDDDDDDDDDD'}"
group="docs"
@move-within-root="moveWithinRoot"
@selected="selected"
@reordered="reordered"
@reorganized="reorganized"
/>
</v-navigation-drawer>
</template>
<script lang="js">
import Docs, { organizeDoc } from '/imports/api/docs/Docs';
import { docsToForest } from '/imports/api/parenting/parentingFunctions';
import TreeNodeList from '/imports/client/ui/components/tree/TreeNodeList.vue';
import { organizeDoc, reorderDoc } from '/imports/api/docs/Docs.js';
import Docs from '/imports/api/docs/Docs.js';
export default {
components: {
TreeNodeList,
@@ -47,7 +45,7 @@ export default {
return Session.get('editingDocs');
},
docs() {
const docs = Docs.find({ removed: {$ne: true} }, { sort: {left: 1} }).fetch();
const docs = Docs.find({ removed: { $ne: true } }, { sort: { left: 1 } }).fetch();
return docsToForest(docs);
},
},
@@ -55,25 +53,12 @@ export default {
selected(docId) {
const doc = Docs.findOne(docId);
if (!doc) return;
console.log(doc.href);
this.$router.push(doc.href);
},
reordered({ doc, newIndex }) {
reorderDoc.callAsync({
docId: doc._id,
order: newIndex,
});
},
reorganized({ doc, parent, newIndex }) {
if (!parent) {
this.refreshTree += 1;
console.error('Moving docs to root level isn\'t implemented');
return;
}
moveWithinRoot({ doc, newPosition }) {
organizeDoc.callAsync({
docId: doc._id,
parentId: parent?._id,
order: newIndex,
newPosition,
});
},
}