<div class="view-space">
	<ul class="documents">
		{{#each documents key="id" as |document|}}
			<li class="document {{if document.selected "selected"}}" id="document-{{document.id}}">

				{{#link-to 'document.index' space.id space.slug document.id document.slug}}
					<div class="title">{{ document.name }}</div>
					<div class="snippet">{{ document.excerpt }}</div>
					{{folder/document-tags documentTags=document.tags}}
					{{#if (not-eq document.lifecycle constants.Lifecycle.Live)}}
						<button type="button" class="mt-3 btn btn-warning text-uppercase font-weight-bold">{{document.lifecycleLabel}}</button>
					{{/if}}
				{{/link-to}}

				{{#if hasDocumentActions}}
					<div class="checkbox" {{action 'selectDocument' document.id}}>
						{{#if document.selected}}
							<i class="material-icons">check_box</i>
						{{else}}
							<i class="material-icons">check_box_outline_blank</i>
						{{/if}}
					</div>
					{{#if document.selected}}
						<div class="actions">
							{{#if permissions.documentMove}}
								<div class="move-documents-button button-icon-green button-icon-small align-middle" {{action 'onShowMoveDocuments'}} data-toggle="tooltip" data-placement="top" title="Move">
									<i class="material-icons">compare_arrows</i>
								</div>
								<div class="button-icon-gap" />
							{{/if}}
							{{#if permissions.documentDelete}}
								<div class="delete-documents-button button-icon-red button-icon-small align-middle" {{action 'onShowDeleteDocuments'}} data-toggle="tooltip" data-placement="top" title="Delete">
									<i class="material-icons">delete</i>
								</div>
							{{/if}}
						</div>
					{{/if}}
				{{/if}}

			</li>
		{{/each}}
	</ul>
</div>

{{#ui/ui-dialog title="Delete Documents" confirmCaption="Delete" buttonType="btn-danger" show=showDeleteDialog onAction=(action
 'onDeleteDocuments')}}
	<p>Are you sure you want to delete {{selectedDocuments.length}} {{selectedCaption}}?</p>
{{/ui/ui-dialog}}

{{#ui/ui-dialog title="Move Documents" confirmCaption="Move" buttonType="btn-success" show=showMoveDialog onAction=(action
 'onMoveDocuments')}}
	<p>Select space for {{selectedDocuments.length}} {{selectedCaption}}</p>
	{{ui/ui-list-picker items=moveOptions nameField='name' singleSelect=true}}
{{/ui/ui-dialog}}

{{#if showAdd}}
	{{empty-state icon="direct" message="Add documents via + DOCUMENT"}}
{{/if}}

{{#if showLockout}}
	{{empty-state icon="visibility" message="Space permissions are preventing you from viewing and creating documents"}}
{{/if}}