Add Personal Tree menu grouping

This commit is contained in:
garrettmills 2020-02-11 00:38:36 -06:00
parent 4a3ebc1ba6
commit b82d7a51f2

View File

@ -11,9 +11,21 @@ class Menu extends Controller {
} }
async get_items(req, res) { async get_items(req, res) {
// Build the "My Tree" option
const root_page = await req.user.get_root_page() const root_page = await req.user.get_root_page()
const nodes = await this._build_menu_object(root_page) const nodes = await this._build_menu_object(root_page)
return res.api(nodes) const menu = []
menu.push({
id: 0,
name: 'My Info Tree',
children: nodes,
noDelete: true,
virtual: true,
expanded: true,
})
return res.api(menu)
} }
async _build_menu_object(parent_node, arr= []) { async _build_menu_object(parent_node, arr= []) {