div.binary-file.full-size(
	ng-controller="BinaryFileController"
	ng-show="ui.view == 'file'"
	ng-if="openFile"
)
	img(
		ng-show="!failedLoad"
		ng-src="/project/{{ project_id }}/file/{{ openFile.id }}"
		ng-if="['png', 'jpg', 'jpeg', 'gif'].indexOf(extension(openFile)) > -1"
		ng-class="{'img-preview': !imgLoaded}"
		onerror="sl_binaryFilePreviewError()"
		onabort="sl_binaryFilePreviewError()"
		onload="sl_binaryFilePreviewLoaded()"
	)

	img(
		ng-show="!failedLoad"
		ng-src="/project/{{ project_id }}/file/{{ openFile.id }}?format=png"
		ng-if="['pdf', 'eps'].indexOf(extension(openFile)) > -1"
		ng-class="{'img-preview': !imgLoaded}"
		onerror="sl_binaryFilePreviewError()"
		onabort="sl_binaryFilePreviewError()"
		onload="sl_binaryFilePreviewLoaded()"
	)
	
	div(ng-if="(['bib'].indexOf(extension(openFile)) > -1) && !bibtexPreview.error")

		div.bib-loading(ng-show="bibtexPreview.loading && !bibtexPreview.error")
			| #{translate('loading')}...

		div.bib-preview(ng-show="bibtexPreview.data && !bibtexPreview.loading && !bibtexPreview.error")
			div.scroll-container
				p
					| {{ bibtexPreview.data }}
				p(ng-show="bibtexPreview.shouldShowDots")
					| ...
	
	p.no-preview(
		ng-if="failedLoad || bibtexPreview.error || ['bib', 'png', 'jpg', 'jpeg', 'gif', 'pdf', 'eps'].indexOf(extension(openFile)) == -1"
	) #{translate("no_preview_available")}

	a.btn.btn-info(
		ng-href="/project/{{ project_id }}/file/{{ openFile.id }}"
	) #{translate("download")} {{ openFile.name }}
