<div class="sidebar-panel">
	<div class="folders-list">

		{{#if session.isEditor}}
			{{#unless showSpace}}
				<div id="add-space-button" class="regular-button button-white" {{action "onToggleNewSpace"}}>
					<i class="material-icons">add</i>
					<div class="name">Space</div>
				</div>
			{{else}}
				<div class="comment-box document-sidebar-form-wrapper">
					<div class="input-control">
						<label>New Space</label>
						<div class="tip">Every space contains related documents</div>
						{{input type='text' id="new-folder-name" class="mousetrap" value=newFolder}}
						{{#unless showClone}}
							<div class="margin-top-30">
								<a {{action "onToggleCloneOptions"}} >Clone existing space &rarr;</a>
							</div>
						{{else}}
							<div class="margin-top-30">
								<p>Clone existing space</p>
								{{ui-select id="owners-dropdown" content=folders prompt="select space" action=(action 'onCloneSpaceSelect') optionValuePath="id" optionLabelPath="name" selection=cloneSpace}}
								<div class="margin-top-20" />
								{{#ui/ui-checkbox selected=copyTemplate}}Templates{{/ui/ui-checkbox}}
								{{#ui/ui-checkbox selected=copyPermission}}Permissions{{/ui/ui-checkbox}}
								{{#ui/ui-checkbox selected=copyDocument}}Documents{{/ui/ui-checkbox}}
							</div>
						{{/unless}}
					</div>
					<div class="regular-button button-blue" {{action "onAdd"}}>Add</div>
					<div class="flat-button flat-gray" {{action "onToggleNewSpace"}}>Cancel</div>
				</div>
			{{/unless}}
		{{/if}}

		{{#unless showSpace}}
			<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}}
		{{/unless}}

	</div>
</div>
