{% import 'input/field.html' as field %} {# generate methods #} {% macro generate_container(cont, config) %} {% if cont.type == 'vertical' %} {{ vertical_container(cont, config) }} {% elif cont.type == 'pairs' %} {{ pairs_container(cont, config) }} {% elif cont.type == 'label' %} {{ label_container(cont, config) }} {% endif %} {% endmacro %} {% macro generate_widget(wid, config, id=none) %} {% if wid.type == 'text' %} {{ text_widget(wid, config, id=id) }} {% elif wid.type == 'label' %} {{ label_widget(wid, config) }} {% elif wid.type == 'string' %} {{ string_widget(wid, config, id=id) }} {% elif wid.type == 'textbox' %} {{ textbox_widget(wid, config, id=id) }} {% elif wid.type == 'list' %} {{ list_widget(wid, config, id=id) }} {% endif %} {% endmacro %} {% macro generate_children(cont, config) %} {% for child in cont.children %} {% if child.category == 'container' %} {{ generate_container(child, config) }} {% else %} {{ generate_widget(child, config) }} {% endif %} {% endfor %} {% endmacro %} {% macro generate(xmlui, form=true, filters=none) %} {# generate HTML from XMLUI @param xmlui(template_xmlui.XMLUIPanel): xmlui to use @param form(bool): if true will generate form elements @param filters(dict,none): filters as expected by item_filter #} {% set config = {'form':form, 'filters':filters or {}} %} {{ generate_container(xmlui.main_cont, config) }} {% endmacro %} {% macro generate_table(xmlui_items, fields, formatters, tr_class_fields, on_click) %} {# generate a HTML table from requested widgets names @param xmlui_items(iterable[unicode]): list of xmlui to show (one per row) @param fields(tuple[unicode,unicode]): fields to show (name, label) @param formatters(dict): dictionary of templates to format values: field_name => template if no formatter is set (or None is used) for a field, it will be used unmodified. current xmlui items will be set as "item" key @param tr_class_fields(iterable[unicode]): name of fields to use as class class will be "{name}_{value}" where name is field name, and value field value all lowercase/stripped @param on_click(data_objects.OnClick): thing to do when clicking on a row #} {% if formatters is undefined %} {% set formatters = {} %} {% endif %}
{{ label }} | {% endfor %}
---|
{% for value in xmlui.widgets[name].values %} {{ value|adv_format(formatters.get(name),item=xmlui.widget_value) }} {% endfor %} | {% endfor %}