Updated preview action to open preview in a new window
authorThierry Florac <tflorac@ulthar.net>
Fri, 14 Dec 2018 14:44:31 +0100
changeset 1172 7724c2dd7a82
parent 1171 41310cefa42a
child 1173 63545f52d9b4
Updated preview action to open preview in a new window
src/pyams_content/features/preview/zmi/__init__.py
src/pyams_content/features/preview/zmi/templates/preview-action.pt
--- a/src/pyams_content/features/preview/zmi/__init__.py	Fri Dec 14 13:32:54 2018 +0100
+++ b/src/pyams_content/features/preview/zmi/__init__.py	Fri Dec 14 14:44:31 2018 +0100
@@ -39,6 +39,7 @@
 
 @viewlet_config(name='preview.action', context=IPreviewTarget, layer=IAdminLayer, view=Interface,
                 manager=IToolbarViewletManager, permisison=VIEW_SYSTEM_PERMISSION, weight=50)
+@template_config(template='templates/preview-action.pt', layer=IAdminLayer)
 class PreviewAction(ToolbarAction):
     """Content preview action"""
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/features/preview/zmi/templates/preview-action.pt	Fri Dec 14 14:44:31 2018 +0100
@@ -0,0 +1,17 @@
+<div class="btn-group"
+	 tal:attributes="class view.group_css_class | default">
+	<div class="${view.css_class}"
+		 data-toggle="${'modal' if view.modal_target else None}"
+		 data-ams-url="${view.get_url()}"
+		 data-ams-stop-propagation="${'true' if view.modal_target else None}"
+		 data-ams-data="${tales:object_data(view)}">
+		<i class="${view.label_css_class}"></i>&nbsp;
+		<tal:var content="view.label" />
+	</div>
+	<div class="${view.css_class} hint"
+		 title="Open preview in new window" i18n:attributes="title"
+		 data-ams-url="${tales:absolute_url(context)}/preview.html"
+		 data-ams-target="_blank">
+		<i class="fa fa-fw fa-window-maximize"></i>&nbsp;
+	</div>
+</div>