Use alternate label in terms tree selection widget when available
authorThierry Florac <thierry.florac@onf.fr>
Fri, 20 Jul 2018 17:19:57 +0200
changeset 82 3a7a8c4c8a15
parent 81 eb0e731f16f8
child 83 bc67813e33a6
Use alternate label in terms tree selection widget when available
src/pyams_thesaurus/zmi/widget/templates/terms-tree-input.pt
--- a/src/pyams_thesaurus/zmi/widget/templates/terms-tree-input.pt	Fri Jul 20 12:55:15 2018 +0200
+++ b/src/pyams_thesaurus/zmi/widget/templates/terms-tree-input.pt	Fri Jul 20 17:19:57 2018 +0200
@@ -1,28 +1,27 @@
 <tal:loop repeat="term view/top_terms">
 	<div class="col col-xs-6 col-sm-4 col-md-3 col-lg-3">
 		<div class="ams-widget" data-ams-widget-toggle-button="false"
-			 tal:define="index python:repeat['term'].index()"
-			 tal:attributes="id string:them_${index}">
+			 id="them_${repeat/term/index}">
 			<header class="no-margin">
-				<h2 tal:content="term/label"></h2>
-			</header>
+				<h2>${python:term.alt or term.label}</h2>
+ 			</header>
 			<div class="widget-body no-padding viewport-y viewport-200 viewport-x-none"
 				 style="height: 200px; width: calc(100% - 2px);">
 				<tal:loop repeat="subterm python:view.get_subterms(term)">
-					<div tal:define="padding python:(subterm.level - 1) * 20"
-						 tal:attributes="style string:padding-left: ${padding}px;; line-height: 1em;;">
+					<div style="padding-left: ${python:(subterm.level - 1) * 20}px; line-height: 1em;">
 						<label class="checkbox"
 							   tal:define="published python:subterm.status == 'published'"
 							   tal:omit-tag="not:published">
 							<input type="checkbox" name="form.widgets.themes:list"
 								   tal:condition="published"
-								   tal:attributes="id string:term_${subterm/label};
-												   name string:${view/name}:list;
-												   value subterm/label;
-												   checked python:subterm.label in view.value" />
+								   id="term_${subterm/label}"
+								   name="${view/name}:list"
+								   value="${subterm/label}"
+								   checked="${python:'checked' if subterm.label in view.value else None}" />
 							<i></i>
-							<div tal:attributes="class python:'' if published else 'bold margin-top-5'"
-								 tal:content="subterm/label"></div>
+							<div class="${python:'' if published else 'bold margin-top-5'}">
+								${python:subterm.alt or subterm.label}
+							</div>
 						</label>
 					</div>
 				</tal:loop>