Updated navigation portlets renderers templates
authorThierry Florac <tflorac@ulthar.net>
Wed, 23 Sep 2020 16:32:28 +0200
changeset 523 4d6c1992822f
parent 522 93329e8abbba
child 524 7f8e82b9a091
Updated navigation portlets renderers templates
src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-carousel.pt
src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal-tabs.pt
src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal.pt
src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-panels.pt
--- a/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-carousel.pt	Tue Sep 08 12:24:16 2020 +0200
+++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-carousel.pt	Wed Sep 23 16:32:28 2020 +0200
@@ -16,11 +16,14 @@
 			<div tal:repeat="link links"
 				 class="item ${'active' if repeat.link.start() else None}">
 				<tal:var define="illustration tales:pyams_illustration(link);
-								 img_data i18n:illustration.data;
-								 alt i18n:illustration.alt_title;
 								 link_info view.get_link_info(link);">
-					${structure:tales:picture(img_data, lg_thumb='pano', md_thumb='pano',
-											  sm_thumb='pano', xs_thumb='pano', alt=alt)}
+					<tal:if condition="illustration">
+						<tal:var define="img_data i18n:illustration.data;
+										 alt i18n:illustration.alt_title;">
+							${structure:tales:picture(img_data, lg_thumb='pano', md_thumb='pano',
+													  sm_thumb='pano', xs_thumb='pano', alt=alt)}
+						</tal:var>
+					</tal:if>
 					<a class="carousel-caption"
 					   href="${link.get_url(request)}">
 						<h3>${link_info.user_title}</h3>
--- a/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal-tabs.pt	Tue Sep 08 12:24:16 2020 +0200
+++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal-tabs.pt	Wed Sep 23 16:32:28 2020 +0200
@@ -16,30 +16,33 @@
 		</li>
 	</ul>
 	<div class="tab-content">
-		<div role="tabpanel"
-			 tal:repeat="link links"
-			 id="link_${tales:cache_key(link)}"
-			 class="tab-pane ${'active' if repeat.link.start() else None}">
-			<div class="col-lg-4 col-md-5 col-sm-12 col-xs-12">
-				<a class="caption"
-				   tal:define="link_info view.get_link_info(link)"
-				   href="${link.get_url(request)}">
-					<h3>${link_info.user_title}</h3>
-				</a>
-				<tal:var define="description i18n:link.description">
-					${structure:tales:html(description)}
+		<tal:loop repeat="link links">
+			<div tal:define="link_info view.get_link_info(link);
+							 link_url link.get_url(request);"
+				 role="tabpanel"
+				 id="link_${tales:cache_key(link)}"
+				 class="tab-pane ${'active' if repeat.link.start() else None}">
+				<div class="col-lg-4 col-md-5 col-sm-12 col-xs-12">
+					<a class="caption"
+					   href="${link_url}">
+						<h3>${link_info.user_title}</h3>
+					</a>
+					<tal:var define="description i18n:link.description">
+						${structure:tales:html(description)}
+					</tal:var>
+				</div>
+				<tal:var define="illustration tales:pyams_illustration(link);"
+						 condition="illustration">
+					<a tal:define="img_data i18n:illustration.data;
+								   alt i18n:illustration.alt_title;"
+					   class="col-lg-8 col-md-7 col-sm-12 col-xs-12"
+					   href="${link_url}">
+						<div class="spacer"></div>
+						${structure:tales:picture(img_data, lg_thumb='pano', lg_width=8, md_thumb='pano', md_width=7,
+												  sm_thumb='pano', sm_width=12, xs_thumb='pano', xs_width=12, alt=alt)}
+					</a>
 				</tal:var>
 			</div>
-			<a tal:define="illustration tales:pyams_illustration(link);
-						   img_data i18n:illustration.data;
-						   alt i18n:illustration.alt_title;
-						   link_info view.get_link_info(link);"
-			   class="col-lg-8 col-md-7 col-sm-12 col-xs-12"
-			   href="${link.get_url(request)}">
-				<div class="spacer"></div>
-				${structure:tales:picture(img_data, lg_thumb='pano', lg_width=8, md_thumb='pano', md_width=7,
-										  sm_thumb='pano', sm_width=12, xs_thumb='pano', xs_width=12, alt=alt)}
-			</a>
-		</div>
+		</tal:loop>
 	</div>
 </div>
\ No newline at end of file
--- a/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal.pt	Tue Sep 08 12:24:16 2020 +0200
+++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal.pt	Wed Sep 23 16:32:28 2020 +0200
@@ -8,13 +8,15 @@
 	<div tal:repeat="link links"
 		 class="panel col-md-3 col-sm-4">
 		<tal:var define="illustration tales:pyams_illustration(link);
-						 img_data i18n:illustration.data;
-						 alt i18n:illustration.alt_title;
 						 link_info view.get_link_info(link);">
-			<a href="${link.get_url(request)}">
-				${structure:tales:picture(img_data, lg_thumb='portrait', lg_width=3, md_thumb='portrait', md_width=3,
-										  sm_thumb='pano', sm_width=12, xs_thumb='pano', xs_width=12, alt=alt)}
-			</a>
+			<tal:if condition="illustration">
+				<a tal:define="img_data i18n:illustration.data;
+							   alt i18n:illustration.alt_title;"
+				   href="${link.get_url(request)}">
+					${structure:tales:picture(img_data, lg_thumb='portrait', lg_width=3, md_thumb='portrait', md_width=3,
+											  sm_thumb='pano', sm_width=12, xs_thumb='pano', xs_width=12, alt=alt)}
+				</a>
+			</tal:if>
 			<a class="caption"
 			   href="${link.get_url(request)}">
 				<h3>${link_info.user_title}</h3>
--- a/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-panels.pt	Tue Sep 08 12:24:16 2020 +0200
+++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-panels.pt	Wed Sep 23 16:32:28 2020 +0200
@@ -8,13 +8,16 @@
 	<div tal:repeat="link links"
 		 class="panel col-sm-4">
 		<tal:var define="illustration tales:pyams_illustration(link);
-						 img_data i18n:illustration.data;
-						 alt i18n:illustration.alt_title;
 						 link_info view.get_link_info(link);">
-			<a href="${link.get_url(request)}">
-				${structure:tales:picture(img_data, lg_thumb='pano', lg_width=4, md_thumb='pano', md_width=4,
-										  sm_thumb='pano', sm_width=4, xs_thumb='pano', xs_width=4, alt=alt)}
-			</a>
+			<tal:if condition="illustration">
+				<tal:var define="img_data i18n:illustration.data;
+								 alt i18n:illustration.alt_title;">
+					<a href="${link.get_url(request)}">
+						${structure:tales:picture(img_data, lg_thumb='pano', lg_width=4, md_thumb='pano', md_width=4,
+												  sm_thumb='pano', sm_width=4, xs_thumb='pano', xs_width=4, alt=alt)}
+					</a>
+				</tal:var>
+			</tal:if>
 			<a class="caption"
 			   href="${link.get_url(request)}">
 				<h3>${link_info.user_title}</h3>