diff default/input/xmlui.html @ 91:cc36a5b990ab

input(xmlui): better handling of missing values
author Goffi <goffi@goffi.org>
date Fri, 12 Jan 2018 19:52:37 +0100
parents 6f1686723472
children eabfb53f7777
line wrap: on
line diff
--- a/default/input/xmlui.html	Fri Jan 12 19:51:04 2018 +0100
+++ b/default/input/xmlui.html	Fri Jan 12 19:52:37 2018 +0100
@@ -67,6 +67,9 @@
     {% if formatters is undefined %}
         {% set formatters = {} %}
     {% endif %}
+    {% if on_click is undefined %}
+        {% set on_click = {} %}
+    {% endif %}
     <table>
         <thead>
             <tr>
@@ -113,6 +116,9 @@
     {% if formatters is undefined %}
         {% set formatters = {} %}
     {% endif %}
+    {% if on_click is undefined %}
+        {% set on_click = {} %}
+    {% endif %}
     <ul class="xmlui_list">
         {% for xmlui in xmlui_items %}
             <li>
@@ -121,7 +127,7 @@
                         'href':link}|xmlattr }}>
                     {% for name,label in fields %}
                         <span {{ {'class': 'xmlui_field__'+name}|xmlattr }}>
-                            {% for label in xmlui.widgets[name].labels %}
+                            {% for label in xmlui.widgets.get(name, {}).labels %}
                                 <span>{{ label|adv_format(formatters.get(name),item=xmlui.widget_value) }}</span>
                             {% endfor %}
                         </span>