comparison 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
comparison
equal deleted inserted replaced
90:042530200fe4 91:cc36a5b990ab
64 all lowercase/stripped 64 all lowercase/stripped
65 @param on_click(data_objects.OnClick): thing to do when clicking on a row 65 @param on_click(data_objects.OnClick): thing to do when clicking on a row
66 #} 66 #}
67 {% if formatters is undefined %} 67 {% if formatters is undefined %}
68 {% set formatters = {} %} 68 {% set formatters = {} %}
69 {% endif %}
70 {% if on_click is undefined %}
71 {% set on_click = {} %}
69 {% endif %} 72 {% endif %}
70 <table> 73 <table>
71 <thead> 74 <thead>
72 <tr> 75 <tr>
73 {% for name,label in fields %} 76 {% for name,label in fields %}
111 @param on_click(data_objects.OnClick): thing to do when clicking on a row 114 @param on_click(data_objects.OnClick): thing to do when clicking on a row
112 #} 115 #}
113 {% if formatters is undefined %} 116 {% if formatters is undefined %}
114 {% set formatters = {} %} 117 {% set formatters = {} %}
115 {% endif %} 118 {% endif %}
119 {% if on_click is undefined %}
120 {% set on_click = {} %}
121 {% endif %}
116 <ul class="xmlui_list"> 122 <ul class="xmlui_list">
117 {% for xmlui in xmlui_items %} 123 {% for xmlui in xmlui_items %}
118 <li> 124 <li>
119 {% set link=on_click.formatUrl(xmlui.widget_value) if on_click.url else none %} 125 {% set link=on_click.formatUrl(xmlui.widget_value) if on_click.url else none %}
120 <a {{ {'class': xmlui|xmlui_class(item_class_fields), 126 <a {{ {'class': xmlui|xmlui_class(item_class_fields),
121 'href':link}|xmlattr }}> 127 'href':link}|xmlattr }}>
122 {% for name,label in fields %} 128 {% for name,label in fields %}
123 <span {{ {'class': 'xmlui_field__'+name}|xmlattr }}> 129 <span {{ {'class': 'xmlui_field__'+name}|xmlattr }}>
124 {% for label in xmlui.widgets[name].labels %} 130 {% for label in xmlui.widgets.get(name, {}).labels %}
125 <span>{{ label|adv_format(formatters.get(name),item=xmlui.widget_value) }}</span> 131 <span>{{ label|adv_format(formatters.get(name),item=xmlui.widget_value) }}</span>
126 {% endfor %} 132 {% endfor %}
127 </span> 133 </span>
128 {% endfor %} 134 {% endfor %}
129 </a> 135 </a>