Updated layout
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 17:59:49 +0200
changeset 161 62497110caec
parent 160 1e22e36e5bec
child 162 90f3c2bc80a7
Updated layout
src/pyams_portal/zmi/templates/layout.pt
--- a/src/pyams_portal/zmi/templates/layout.pt	Sat Jul 21 16:28:49 2018 +0200
+++ b/src/pyams_portal/zmi/templates/layout.pt	Mon Aug 27 17:59:49 2018 +0200
@@ -5,27 +5,27 @@
 	<div class="ams-widget"
 		 data-ams-focus-target
 		 data-ams-plugins="pyams_portal"
-		 tal:attributes="data-ams-plugin-pyams_portal-src tales:resource_path('pyams_portal:pyams_portal');
-						 data-ams-plugin-pyams_portal-css tales:resource_path('pyams_portal:pyams_portal_css');"
+		 data-ams-plugin-pyams_portal-src="${tales:resource_path('pyams_portal:pyams_portal')}"
+		 data-ams-plugin-pyams_portal-css="${tales:resource_path('pyams_portal:pyams_portal_css')}"
 		 data-ams-plugin-pyams_portal-callback="PyAMS_portal.template.initConfig">
 		<header>
 			<span tal:condition="view.widget_icon_class | nothing"
 				  class="widget-icon"><i tal:attributes="class view.widget_icon_class"></i>
 			</span>
-			<h2 tal:content="view.title">Title</h2>
-			<tal:var content="structure provider:pyams.widget_title" />
-			<tal:var content="structure provider:pyams.toolbar" />
+			<h2>${view.title}</h2>
+			<tal:var>${structure:provider:pyams.widget_title}</tal:var>
+			<tal:var>${structure:provider:pyams.toolbar}</tal:var>
 		</header>
 		<div class="widget-body">
 			<div class="btn-toolbar" role="toolbar"
 				 tal:condition="can_change">
 				<div class="btn-group" role="group">
-					<div class="btn btn-default btn-row hint"
+					<div class="btn btn-default btn-row bg-color-silverLight hint"
 						 title="Add row<br />Drag and drop button to page template to position new row" i18n:attributes="title"
 						 data-ams-hint-gravity="n" data-ams-hint-html="true">
 						<i class="fa fa-fw fa-2x fa-indent"></i>
 					</div>
-					<div class="btn btn-default btn-slot hint"
+					<div class="btn btn-default btn-slot bg-color-silverLight hint"
 						 title="Add slot<br />Drag and drop button to page template to position new slot" i18n:attributes="title"
 						 data-ams-hint-gravity="n" data-ams-hint-html="true">
 						<i class="fa fa-fw fa-2x fa-columns"></i>
@@ -33,17 +33,19 @@
 				</div>
 				<div class="btn-group" role="group">
 					<div tal:repeat="portlet view.selected_portlets"
-						 class="btn btn-default btn-portlet hint" data-ams-hint-gravity="n" data-ams-hint-html="true"
-						 tal:attributes="data-ams-portlet-name portlet.name;
-										 title view.get_portlet_add_label(portlet);">
+						 class="btn btn-default btn-portlet hint"
+						 data-ams-hint-gravity="n" data-ams-hint-html="true"
+						 data-ams-portlet-name="${portlet.name}"
+						 title="${view.get_portlet_add_label(portlet)}">
 						<img tal:condition="portlet.toolbar_image"
-							 tal:attributes="src portlet.toolbar_image" />
+							 src="${portlet.toolbar_image}" />
 						<i tal:condition="portlet.toolbar_css_class"
-						   tal:attributes="class portlet.toolbar_css_class"></i>
+						   class="${portlet.toolbar_css_class}"></i>
 					</div>
 				</div>
 				<div class="btn-group" role="group">
-					<div class="btn btn-default hint" data-ams-url="add-template-portlet.html" data-toggle="modal"
+					<div class="btn btn-default hint"
+						 data-ams-url="add-template-portlet.html" data-toggle="modal"
 						 data-ams-hint-gravity="n"
 						 title="Add another portlet..." i18n:attributes="title">
 						<i class="fa fa-fw fa-2x fa-plus"></i>
@@ -67,7 +69,7 @@
 				</div>
 			</div>
 			<div id="portal_config" class="container"
-				 tal:attributes="data-ams-allowed-change 'true' if can_change else 'false'">
+				 data-ams-allowed-change="${'true' if can_change else 'false'}">
 				<div class="rows"
 					 data-ams-sortable-placeholder="row-highlight"
 					 data-ams-sortable-items="> .row"
@@ -76,7 +78,7 @@
 					<div class="row context-menu"
 						 data-ams-contextmenu-selector="#rowMenu"
 						 tal:repeat="row range(template_config.rows)"
-						 tal:attributes="data-ams-row-id row;">
+						 data-ams-row-id="${row}">
 						<strong class="row_id label label-success pull-left"
 								tal:content="row"></strong>
 						<strong class="row_id label label-success pull-right"
@@ -86,39 +88,45 @@
 							 data-ams-sortable-connectwith=".slots"
 							 data-ams-sortable-over="PyAMS_portal.template.overSlots"
 							 data-ams-sortable-stop="PyAMS_portal.template.sortSlots">
-							<div class="slot context-menu col col-md-12 no-padding"
+							<div tal:repeat="slot_name template_config.get_slots(row)"
+								 class="slot context-menu col col-md-12 no-padding"
 								 data-ams-contextmenu-selector="#slotMenu"
 								 data-ams-resizable-start="PyAMS_portal.template.startSlotResize"
 								 data-ams-resizable-stop="PyAMS_portal.template.stopSlotResize"
 								 data-ams-resizable-handles="e"
-								 tal:repeat="slot_name template_config.get_slots(row)"
-								 tal:attributes="class string:slot context-menu col ${template_config.get_slot_configuration(slot_name).get_css_class()};
-												 data-ams-slot-name slot_name;">
+								 class="slot context-menu col ${template_config.get_slot_configuration(slot_name).get_css_class()}"
+								 data-ams-slot-name="${slot_name}">
 								<div class="header padding-x-5">
 									<i class="fa fa-fw fa-minus-square pull-right padding-top-2" data-ams-click-handler="PyAMS_portal.template.switchSlot"></i>
-									<tal:var content="slot_name" />
+									${slot_name}
 								</div>
 								<div class="portlets"
 									 data-ams-sortable-placeholder="portlet-highlight"
 									 data-ams-sortable-connectwith=".portlets"
 									 data-ams-sortable-over="PyAMS_portal.template.overPortlets"
 									 data-ams-sortable-stop="PyAMS_portal.template.sortPortlets">
-									<div class="portlet context-menu"
+									<div tal:repeat="portlet_id template_config.slot_config[slot_name].portlet_ids"
+										 class="portlet context-menu"
 										 data-ams-contextmenu-selector="#portletMenu"
-										 tal:repeat="portlet_id template_config.slot_config[slot_name].portlet_ids"
-										 tal:attributes="data-ams-portlet-id portlet_id;">
+										 data-ams-portlet-id="${portlet_id}">
 										<div class="header padding-x-5"
 											 tal:define="current_config portlet_config.get_portlet_configuration(portlet_id);
 														 portlet_name current_config.portlet_name;">
-											<i class="fa fa-fw fa-minus-square pull-right padding-top-2" data-ams-click-handler="PyAMS_portal.template.switchPortlet"></i>
-											<tal:var content="view.get_portlet_label(portlet_name)" />
+											<i class="fa fa-fw fa-minus-square pull-right padding-top-2 hint opaque align-base"
+											   data-ams-click-handler="PyAMS_portal.template.switchPortlet"
+											   data-ams-hint-gravity="se"
+											   title="Reduce/restore portlet" i18n:attributes="title"></i>
+											${view.get_portlet_label(portlet_name)}
+											<i class="fa fa-fw fa-edit hint opaque align-base"
+											   data-ams-url="PyAMS_portal.template.editPortlet"
+											   data-ams-hint-gravity="se" data-ams-hint-offset="2"
+											   title="Edit portlet properties" i18n:attributes="title"></i>
 											<tal:if condition="current_config.can_inherit">
-												<i title="Override parent or template settings" i18n:attributes="title"
-												   tal:attributes="class python:'chain fa fa-fw {0} fa-rotate-90 hint opaque align-base'.format('fa-chain-broken' if not current_config.inherit_parent else '')"></i>
+												<i title="Portlet settings are not those of original template" i18n:attributes="title"
+												   class="${'chain fa fa-fw {0} fa-rotate-90 hint opaque align-base'.format('fa-chain-broken' if not current_config.inherit_parent else '')}"></i>
 											</tal:if>
 										</div>
-										<div class="preview"
-											 tal:content="structure view.get_portlet_preview(portlet_id)"></div>
+										<div class="preview">${structure:view.get_portlet_preview(portlet_id)}</div>
 									</div>
 								</div>
 								<div class="clearfix"></div>