Easy access to full-page preview
authorThierry Florac <thierry.florac@onf.fr>
Fri, 16 Nov 2018 08:55:51 +0100
changeset 1095 6bccc6acea9d
parent 1094 465b273c312b
child 1096 a9a423fe6d02
Easy access to full-page preview
src/pyams_content/features/preview/zmi/templates/preview.pt
--- a/src/pyams_content/features/preview/zmi/templates/preview.pt	Thu Nov 15 17:51:43 2018 +0100
+++ b/src/pyams_content/features/preview/zmi/templates/preview.pt	Fri Nov 16 08:55:51 2018 +0100
@@ -1,6 +1,7 @@
 <div class="modal-dialog modal-medium"
 	 style="height: calc(100% - 50px);"
-	 tal:attributes="class string:modal-dialog ${view.dialog_class}">
+	 tal:define="preview_url tales:absolute_url(context, 'preview.html')"
+	 tal:attributes="class string:modal-dialog ${view.dialog_class}" i18n:domain="pyams_content">
 	<div class="modal-content">
 		<div class="modal-header"
 			 tal:define="header provider:form_header">
@@ -15,6 +16,11 @@
 				<h3 class="modal-title"
 					tal:define="config tales:configuration;">
 					<span class="title" tal:content="structure view.title | context.title | config.title">Title</span>
+					<a class="hint"
+					   href="${preview_url}" target="_blank"
+					   title="Open in new window" i18n:attributes="title">
+						<i class="fa fa-fw fa-window-maximize"></i>
+					</a>
 				</h3>
 				<tal:var replace="structure provider:form_toolbar" />
 			</tal:if>
@@ -23,9 +29,7 @@
 			<tal:var define="langs view.languages" i18n:domain="pyams_content">
 				<tal:if condition="len(langs) == 1">
 					<div class="margin-top-10">
-						<iframe src="preview.html" frameborder="0" style="width: 100%;"
-								tal:define="url tales:absolute_url(context, 'preview.html')"
-								tal:attributes="src string:${url}?lang=${langs[0]}"
+						<iframe src="${preview_url}?lang=${langs[0]}" frameborder="0" style="width: 100%;"
 								onload="this.style.height = (jQuery(parent.window).height() - 150) + 'px'"></iframe>
 					</div>
 				</tal:if>