{{#toolbar/t-toolbar}}

	{{#toolbar/t-links}}
		{{#link-to "folder" space.id space.slug class="link selected" tagName="li"}}{{space.name}}{{/link-to}}
		{{#if showDocumentLink}}
			{{#link-to 'document.index' space.id space.slug document.id document.slug class="link"}}{{document.name}}{{/link-to}}
		{{/if}}
	{{/toolbar/t-links}}

	{{#if showTools}}
		{{#toolbar/t-actions}}
			{{#if session.authenticated}}
				{{#if permissions.documentAdd}}
					<div id="document-template-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save as template">
						<i class="material-icons" data-toggle="modal" data-target="#document-template-modal" data-backdrop="static">content_copy</i>
					</div>
					<div class="button-icon-gap" />
					<div id="document-template-modal" class="modal" tabindex="-1" role="dialog">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header">Save as Template</div>
								<div class="modal-body">
									<form onsubmit={{action 'onSaveTemplate'}}>
										<div class="form-group">
											<label for="new-template-name">Name</label>
											{{input id="new-template-name" value=saveTemplate.name type='email' class="form-control mousetrap" placeholder="Template name"}}
											<small class="form-text text-muted">Good template name conveys document type</small>
										</div>
										<div class="form-group">
											<label for="new-template-desc">Description</label>
											{{textarea id="new-template-desc" value=saveTemplate.description class="form-control" rows="5"}}
											<small class="form-text text-muted">Explain use case for this template</small>
										</div>
									</form>
								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
									<button type="button" class="btn btn-success" onclick={{action 'onSaveTemplate'}}>Save</button>
								</div>
							</div>
						</div>
					</div>
				{{/if}}
			{{/if}}

			<div id="document-print-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Print" {{action 'onPrintDocument'}}>
				<i class="material-icons">print</i>
			</div>
			<div class="button-icon-gap" />

			{{#if pinState.isPinned}}
				<div id="document-pin-button" class="button-icon-gold align-middle" data-toggle="tooltip" data-placement="top" title="Remove favorite" {{action 'onUnpin'}}>
					<i class="material-icons">star</i>
				</div>
				<div class="button-icon-gap" />
			{{else if session.authenticated}}
				<div id="document-pin-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save favorite" {{action 'onPin'}}>
					<i class="material-icons">star</i>
				</div>
				<div class="button-icon-gap" />
			{{/if}}

			{{#if permissions.documentDelete}}
				<div id="document-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete document">
					<i class="material-icons" data-toggle="modal" data-target="#document-delete-modal" data-backdrop="static">delete</i>
				</div>
				<div class="button-icon-gap" />
				<div id="document-delete-modal" class="modal" tabindex="-1" role="dialog">
					<div class="modal-dialog" role="document">
						<div class="modal-content">
							<div class="modal-header">Delete Document</div>
							<div class="modal-body">
								<p>Are you sure you want to delete this document?</p>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
								<button type="button" class="btn btn-danger" onclick={{action 'onDocumentDelete'}}>Delete</button>
							</div>
						</div>
					</div>
				</div>
			{{/if}}
		{{/toolbar/t-actions}}
	{{/if}}

{{/toolbar/t-toolbar}}
