<div class="sidebar-panel">
	<div class="space-tools">
		{{#if showingDocument}}
			{{folder/start-document savedTemplates=savedTemplates folder=folder editor=folderService.canEditCurrentFolder
				onImport=(action 'onImport')
				onEditTemplate=(action 'onEditTemplate')
				onDocumentTemplate=(action 'onDocumentTemplate')}}
		{{/if}}
	</div>

	<div class="folders-list">
		{{#if session.isEditor}}
			<div id="add-space-button" class="regular-button button-white">
				<i class="material-icons">add</i>
				<div class="name">Space</div>
			</div>
			{{#dropdown-dialog target="add-space-button" position="bottom left" button="Add" color="flat-green" onAction=(action 'addFolder') focusOn="new-folder-name" }}
				<div>
					<div class="input-control">
						<label>New space</label>
						<div class="tip">A repository for related documentation</div>
						{{input type='text' id="new-folder-name" class="mousetrap" value=newFolder}}
					</div>
				</div>
			{{/dropdown-dialog}}
		{{/if}}

		<div class="section">
			<div class="heading">EVERYONE</div>
			{{#unless hasPublicFolders}}
				<div class="message margin-left-15">No global spaces</div>
			{{/unless}}
			<ul class="list">
				{{#each publicFolders as |folder|}}
					{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
						<li class="item">{{ folder.name }}</li>
					{{/link-to}}
				{{/each}}
			</ul>
		</div>

		{{#if session.authenticated}}
			<div class="section">
				<div class="heading">TEAM</div>
				{{#unless hasProtectedFolders}}
					<div class="message margin-left-15">No protected spaces</div>
				{{/unless}}
				<ul class="list">
					{{#each protectedFolders as |folder|}}
						{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
							<li class="item">{{ folder.name }}</li>
						{{/link-to}}
					{{/each}}
				</ul>
			</div>

			<div class="section">
				<div class="heading">PERSONAL</div>
				{{#unless hasPrivateFolders}}
					<div class="message margin-left-15">No private spaces</div>
				{{/unless}}
				<ul class="list">
					{{#each privateFolders as |folder|}}
						{{#link-to 'folder' folder.id folder.slug class="link" activeClass='selected' }}
							<li class="item">{{ folder.name }}</li>
						{{/link-to}}
					{{/each}}
				</ul>
			</div>
		{{/if}}
	</div>
</div>
