extends ../layout.pug

mixin tocMenu(ti)
	each node in ti
		li
			a(href='#' + node.anchor, title=node.content)= node.content
			if node.nodes.length > 0
				ul
					+tocMenu(node.nodes)

block rootNavRight
	i.nav-item#notifload
	a.nav-item.btn-move-prompt.is-hidden
		| Move
	a.nav-item(href='/source/' + pageData.meta.path)
		| Source
	span.nav-item
		a.button(href='/edit/' + pageData.meta.path)
			span.icon
				i.fa.fa-edit
			span Edit
		a.button.is-primary.btn-create-prompt
			span.icon
				i.fa.fa-plus
			span Create

block content

	#page-type-view(data-entrypath=pageData.meta.path)
		section.section
			.container.is-fluid
				.columns

					.column.is-narrow.sd-menus.is-hidden-touch

						.box
							aside.menu(style= { 'min-width': '200px' })
								p.menu-label
									| Navigation
								ul.menu-list
									li
										a(href='/') Home
									if pageData.parent
										li
											a(href='/' + pageData.parent.path)= pageData.parent.title
									li
										a(href='/account') Account
						.box.stickyscroll(data-margin-top=70)
							aside.menu(style= { 'min-width': '200px' })
								p.menu-label
									| Contents
								ul.menu-list
									a(href='#root', title='Start') Start
									+tocMenu(pageData.tree)

					.column

						h1.title#title= pageData.meta.title
						if pageData.meta.subtitle
							h2.subtitle= pageData.meta.subtitle
						.content.mkcontent
							!= pageData.html

	include ../modals/create.pug
	include ../modals/move.pug
