Updated admin layout to provides more favicons
authorThierry Florac <thierry.florac@onf.fr>
Fri, 12 Oct 2018 11:55:25 +0200
changeset 96 fcb69669c40c
parent 95 9957b31eb006
child 97 6f8fdaa85ee8
Updated admin layout to provides more favicons
src/pyams_zmi/interfaces/templates/admin-layout.pt
--- a/src/pyams_zmi/interfaces/templates/admin-layout.pt	Fri Oct 05 15:10:28 2018 +0200
+++ b/src/pyams_zmi/interfaces/templates/admin-layout.pt	Fri Oct 12 11:55:25 2018 +0200
@@ -7,10 +7,30 @@
 <head>
 	<tal:var replace="structure tales:metas" />
 
-	<tal:if define="icon config.icon | nothing; url tales:absolute_url(icon);" condition="icon">
+	<tal:if define="icon config.icon | nothing;
+					url tales:absolute_url(icon);"
+			condition="icon">
 		<!-- Favorite icon -->
-		<link rel="shortcut icon" tal:attributes="href url" type="image/x-icon">
-		<link rel="icon" tal:attributes="href url" type="image/x-icon">
+		<tal:var define="size icon.get_image_size()[0];
+						 timestamp tales:timestamp(icon)">
+			<link tal:condition="size > 144"
+				  rel="apple-touch-icon" sizes="180x180" href="${url}/++thumb++180x180?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 114"
+				  rel="apple-touch-icon" sizes="144x144" href="${url}/++thumb++144x144?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 72"
+				  rel="apple-touch-icon" sizes="114x114" href="${url}/++thumb++114x114?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 32"
+				  rel="apple-touch-icon" sizes="72x72" href="${url}/++thumb++72x72?_=${timestamp}" type="${icon.content_type}" />
+			<link rel="apple-touch-icon" sizes="16x16" href="${url}/++thumb++16x16?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 64"
+				  rel="icon" sizes="128x128" href="${url}/++thumb++128x128?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 32"
+				  rel="icon" sizes="64x64" href="${url}/++thumb++64x64?_=${timestamp}" type="${icon.content_type}" />
+			<link tal:condition="size > 16"
+				  rel="icon" sizes="32x32" href="${url}/++thumb++32x32?_=${timestamp}" type="${icon.content_type}" />
+			<link rel="icon" sizes="16x16" href="${url}/++thumb++16x16?_=${timestamp}" type="${icon.content_type}" />
+			<link rel="shortcut icon" href="${url}" type="${icon.content_type}" />
+		</tal:var>
 	</tal:if>
 
 	<tal:var replace="tales:resources" />