Include child nodes in menu tree (Noded/frontend#17)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -221,6 +221,52 @@ class Page extends Model {
|
||||
await user.save()
|
||||
}
|
||||
|
||||
async get_menu_items() {
|
||||
// {
|
||||
// id: child.UUID,
|
||||
// name: child.is_shared() ? child.Name + ' ⁽ˢʰᵃʳᵉᵈ⁾' : child.Name,
|
||||
// shared: child.is_shared(),
|
||||
// children: await this._build_menu_object(child),
|
||||
// type: 'page',
|
||||
// }
|
||||
|
||||
// Databases & Code Snips
|
||||
const children = []
|
||||
|
||||
const Database = this.models.get('api:db:Database')
|
||||
const dbs = await Database.find({
|
||||
Active: true,
|
||||
PageId: this.UUID,
|
||||
})
|
||||
|
||||
for ( const db of dbs ) {
|
||||
children.push({
|
||||
id: db.PageId,
|
||||
node_id: db.NodeId,
|
||||
children: [],
|
||||
type: 'db',
|
||||
name: db.Name,
|
||||
})
|
||||
}
|
||||
|
||||
const Codium = this.models.get('api:Codium')
|
||||
const codiums = await Codium.find({
|
||||
PageId: this.UUID,
|
||||
})
|
||||
|
||||
for ( const codium of codiums ) {
|
||||
children.push({
|
||||
id: codium.PageId,
|
||||
node_id: codium.NodeId,
|
||||
children: [],
|
||||
type: 'code',
|
||||
name: codium.code.slice(0, 25) + (codium.code.length > 25 ? '...' : ''),
|
||||
})
|
||||
}
|
||||
|
||||
return children
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = exports = Page;
|
||||
|
||||
Reference in New Issue
Block a user