changeset 91:cc36a5b990ab

input(xmlui): better handling of missing values
author Goffi <goffi@goffi.org>
date Fri, 12 Jan 2018 19:52:37 +0100
parents 042530200fe4
children 2963996373fa
files default/input/xmlui.html
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
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>