Mercurial > libervia-templates
annotate sat_templates/templates/default/input/xmlui.html @ 294:a587d664f62c
bulma (dialogs,css): added `modal-dialog` to avoid transforming other modals
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Nov 2020 12:15:39 +0100 |
parents | 15db910a957a |
children | 16b3a2988afd |
rev | line source |
---|---|
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 {% import 'input/field.html' as field %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 {# generate methods #} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
5 {% macro generate_container(cont, config) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 {% if cont.type == 'vertical' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
7 {{ vertical_container(cont, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 {% elif cont.type == 'pairs' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
9 {{ pairs_container(cont, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 {% elif cont.type == 'label' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
11 {{ label_container(cont, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 {% endif %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
15 {% macro generate_widget(wid, config, id=none) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 {% if wid.type == 'text' %} |
66 | 17 {{ text_widget(wid, config, id=id) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 {% elif wid.type == 'label' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
19 {{ label_widget(wid, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 {% elif wid.type == 'string' %} |
66 | 21 {{ string_widget(wid, config, id=id) }} |
65
dd15b6c0b1d3
input/xmlui: added 'jid' widget type, using string_widget for now
Goffi <goffi@goffi.org>
parents:
58
diff
changeset
|
22 {% elif wid.type == 'jid' %} |
dd15b6c0b1d3
input/xmlui: added 'jid' widget type, using string_widget for now
Goffi <goffi@goffi.org>
parents:
58
diff
changeset
|
23 {# TODO: proper JID widget #} |
66 | 24 {{ string_widget(wid, config, id=id) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 {% elif wid.type == 'textbox' %} |
66 | 26 {{ textbox_widget(wid, config, id=id) }} |
169
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
27 {% elif wid.type == 'xhtmlbox' %} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
28 {{ xhtmlbox_widget(wid, config, id=id) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 {% elif wid.type == 'list' %} |
66 | 30 {{ list_widget(wid, config, id=id) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 {% endif %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
34 {% macro generate_children(cont, config) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 {% for child in cont.children %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 {% if child.category == 'container' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
37 {{ generate_container(child, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 {% else %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
39 {{ generate_widget(child, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 {% endif %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 {% endfor %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 |
58
4347910cc594
input(xmlui): added attributes argument to create:
Goffi <goffi@goffi.org>
parents:
55
diff
changeset
|
45 {% macro generate(xmlui, form=true, filters=none, attributes=none) %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
46 {# generate HTML from XMLUI |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
47 @param xmlui(template_xmlui.XMLUIPanel): xmlui to use |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
48 @param form(bool): if true will generate form elements |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
49 @param filters(dict,none): filters as expected by item_filter |
58
4347910cc594
input(xmlui): added attributes argument to create:
Goffi <goffi@goffi.org>
parents:
55
diff
changeset
|
50 @param attributes(dict,none): extra attributes to put on named widgets |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
51 #} |
58
4347910cc594
input(xmlui): added attributes argument to create:
Goffi <goffi@goffi.org>
parents:
55
diff
changeset
|
52 {% set config = {'form':form, 'filters':filters or {}, 'attrs': attributes or {}} %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
53 {{ generate_container(xmlui.main_cont, config) }} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
54 {% endmacro %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
55 |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
56 {% macro generate_table(xmlui_items, fields, formatters, tr_class_fields, on_click) %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
57 {# generate a HTML table from requested widgets names |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
58 @param xmlui_items(iterable[unicode]): list of xmlui to show (one per row) |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
59 @param fields(tuple[unicode,unicode]): fields to show (name, label) |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
60 @param formatters(dict): dictionary of templates to format values: |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
61 field_name => template |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
62 if no formatter is set (or None is used) for a field, it will be used unmodified. |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
63 current xmlui items will be set as "item" key |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
64 @param tr_class_fields(iterable[unicode]): name of fields to use as class |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
65 class will be "{name}_{value}" where name is field name, and value field value |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
66 all lowercase/stripped |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
67 @param on_click(data_objects.OnClick): thing to do when clicking on a row |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
68 #} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
69 {% if formatters is undefined %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
70 {% set formatters = {} %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
71 {% endif %} |
91
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
72 {% if on_click is undefined %} |
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
73 {% set on_click = {} %} |
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
74 {% endif %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
75 <table> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
76 <thead> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
77 <tr> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
78 {% for name,label in fields %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
79 <th>{{ label }}</th> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
80 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
81 </tr> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
82 </thead> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
83 <tbody> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
84 {% for xmlui in xmlui_items %} |
107
eabfb53f7777
input(xmlui): follow changes for OnClick data object in backend
Goffi <goffi@goffi.org>
parents:
91
diff
changeset
|
85 {% set link=on_click.formatUrl(item=xmlui.widget_value) if on_click.url else none %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
86 <tr {{ {'class': xmlui|xmlui_class(tr_class_fields)}|xmlattr }}> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
87 |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
88 {% for name,label in fields %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
89 <td {{ {'class': 'td_'+name}|xmlattr }}> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
90 {% for value in xmlui.widgets[name].values %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
91 <a {{ {'href':link}|xmlattr }}>{{ value|adv_format(formatters.get(name),item=xmlui.widget_value)Â }}</a> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
92 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
93 </td> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
94 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
95 </tr> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
96 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
97 </tbody> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
98 </table> |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 |
71
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
101 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
102 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
103 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
104 {% macro generate_list(xmlui_items, fields, formatters, item_class_fields, on_click) %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
105 {# generate a list of rendered XMLUI from requested widgets names |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
106 very similar to generate_table but generate a list instead of a tabme |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
107 @param xmlui_items(iterable[unicode]): list of xmlui to show |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
108 @param fields(tuple[unicode,unicode]): fields to show (name, label) |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
109 @param formatters(dict): dictionary of templates to format values: |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
110 field_name => template |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
111 if no formatter is set (or None is used) for a field, it will be used unmodified. |
107
eabfb53f7777
input(xmlui): follow changes for OnClick data object in backend
Goffi <goffi@goffi.org>
parents:
91
diff
changeset
|
112 current xmlui items will be set as "item" key for the template |
71
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
113 @param item_class_fields(iterable[unicode]): name of fields to use as class |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
114 class will be "{name}_{value}" where name is field name, and value field value |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
115 all lowercase/stripped |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
116 @param on_click(data_objects.OnClick): thing to do when clicking on a row |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
117 #} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
118 {% if formatters is undefined %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
119 {% set formatters = {} %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
120 {% endif %} |
91
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
121 {% if on_click is undefined %} |
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
122 {% set on_click = {} %} |
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
123 {% endif %} |
71
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
124 <ul class="xmlui_list"> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
125 {% for xmlui in xmlui_items %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
126 <li> |
107
eabfb53f7777
input(xmlui): follow changes for OnClick data object in backend
Goffi <goffi@goffi.org>
parents:
91
diff
changeset
|
127 {% set link=on_click.formatUrl(item=xmlui.widget_value) if on_click.url else none %} |
71
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
128 <a {{ {'class': xmlui|xmlui_class(item_class_fields), |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
129 'href':link}|xmlattr }}> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
130 {% for name,label in fields %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
131 <span {{ {'class': 'xmlui_field__'+name}|xmlattr }}> |
91
cc36a5b990ab
input(xmlui): better handling of missing values
Goffi <goffi@goffi.org>
parents:
71
diff
changeset
|
132 {% for label in xmlui.widgets.get(name, {}).labels %} |
71
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
133 <span>{{ label|adv_format(formatters.get(name),item=xmlui.widget_value)Â }}</span> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
134 {% endfor %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
135 </span> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
136 {% endfor %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
137 </a> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
138 </li> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
139 {% endfor %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
140 </ul> |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
141 {% endmacro %} |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
142 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
143 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
144 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
145 |
6f1686723472
input(xmlui): added generate_list method, similar to generate_table but generate list of items instead.
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
146 |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 {# containers #} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
149 {% macro vertical_container(cont, config) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 <div class="xmlui_cont xmlui_cont_vertical"> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
151 {{ generate_children(cont, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 </div> |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
155 {% macro pairs_container(cont, config) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
156 {# TODO: proper impelmentation (do the same as vertical container for now #} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
157 <div class="xmlui_cont xmlui_cont_vertical"> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
158 {{ generate_children(cont, config) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
159 </div> |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
160 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
161 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
162 {% macro label_container(cont, config) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
163 <div class="xmlui_cont xmlui_cont_vertical"> |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
164 {% for child in cont.children %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
165 {% if loop.index is odd %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
166 {# label #} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
167 {% if child.type == 'label' %} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
168 {% set for_ = ('wid_' + (child.for_name or child.name or '_noname'))|next_gidx %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
169 {{ label_widget(child, config, for=for_) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 {% endif %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
171 {% else %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
172 {# widget #} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
173 {% set id = ('wid_' + (child.name or '_noname'))|cur_gidx %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
174 {{ generate_widget(child, config, id=id) }} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 {% endif %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
176 {% endfor %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
177 </div> |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 {% endmacro %} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
181 {# widgets #} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
182 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
183 {% macro text_widget(wid, config, id=none) %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
184 <p class="xmlui_widget xmlui_text" {{ {'id':id}|xmlattr }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
185 {{- wid|item_filter(config.filters)|default('\u00A0',true) -}} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
186 </p> |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
187 {% endmacro%} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
188 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
189 {% macro label_widget(wid, config, for=none) %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
190 {% if config.form %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
191 <label class="xmlui_widget xmlui_label" {{ {'for':for}|xmlattr }}> |
55
d58fdd57df49
input/xmlui: fixed for_name in labels + selection in listWidget
Goffi <goffi@goffi.org>
parents:
53
diff
changeset
|
192 {{wid|item_filter(config.filters)}} |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
193 </label> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
194 {% else %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
195 <span class="xmlui_widget xmlui_label" {{ {'id':none if not for else 'label_%s'|format(for)}|xmlattr }}>{{wid|item_filter(config.filters)}}</span> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
196 {% endif %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
197 {% endmacro%} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
198 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
199 {% macro string_widget(wid, config, id=none) %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
200 {% if config.form %} |
205
e03e085bf7e8
input (xmlui): add "readonly" attribute in string_widget when suitable.
Goffi <goffi@goffi.org>
parents:
169
diff
changeset
|
201 <input class="xmlui_widget xmlui_string" type="text" {{ {'name':wid.name, 'id':id, 'value':wid|item_filter(config.filters)}|dict_ext(config.attrs, wid.name)|xmlattr }} |
e03e085bf7e8
input (xmlui): add "readonly" attribute in string_widget when suitable.
Goffi <goffi@goffi.org>
parents:
169
diff
changeset
|
202 {{ "readonly" if wid.read_only }} > |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
203 {% else %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
204 <div class="xmlui_widget xmlui_string" {{ {'id':id}|xmlattr }}> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
205 {{- wid|item_filter(config.filters)|default('\u00A0',true) -}} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
206 </div> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
207 {% endif %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
208 {% endmacro%} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
209 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
210 {% macro textbox_widget(wid, config, id=none) %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
211 {% if config.form %} |
58
4347910cc594
input(xmlui): added attributes argument to create:
Goffi <goffi@goffi.org>
parents:
55
diff
changeset
|
212 <textarea class="xmlui_widget xmlui_textbox" rows="10" cols="50" {{ {'name':wid.name, 'id':id}|dict_ext(config.attrs, wid.name)|xmlattr }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
213 {{- wid|item_filter(config.filters) -}} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
214 </textarea> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
215 {% else %} |
66 | 216 <p class="xmlui_widget xmlui_textbox" {{ {'id':id}|xmlattr }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
217 {{- wid|item_filter(config.filters) -}} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
218 </p> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
219 {% endif %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 {% endmacro%} |
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 |
169
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
222 {% macro xhtmlbox_widget(wid, config, id=none) %} |
207
15db910a957a
input (xmlui): don't use <textarea> in xhtmlbox_widget if we are not in a form
Goffi <goffi@goffi.org>
parents:
205
diff
changeset
|
223 {% if not config.form or wid.read_only %} |
169
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
224 <div class="xmlui_widget xmlui_xhtmlbox" {{ {'id':id}|xmlattr }}> |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
225 {{- wid|item_filter(config.filters) -}} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
226 </div> |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
227 {% else %} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
228 <textarea class="xmlui_widget xmlui_xhtmlbox" rows="10" cols="50" {{ {'name':wid.name, 'id':id}|dict_ext(config.attrs, wid.name)|xmlattr }}> |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
229 {{- wid|item_filter(config.filters) -}} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
230 </textarea> |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
231 {% endif %} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
232 {% endmacro%} |
4b5ad18f6ece
input (xmlui): added support for XHTMLBox
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
233 |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
234 {% macro list_widget(wid, config, id=none) %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
235 {% if config.form %} |
58
4347910cc594
input(xmlui): added attributes argument to create:
Goffi <goffi@goffi.org>
parents:
55
diff
changeset
|
236 <select class="xmlui_widget xmlui_list" {{ {'name':wid.name, 'id':id}|dict_ext(config.attrs, wid.name)|xmlattr }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
237 {% for value,label in wid.options %} |
55
d58fdd57df49
input/xmlui: fixed for_name in labels + selection in listWidget
Goffi <goffi@goffi.org>
parents:
53
diff
changeset
|
238 <option {{ {'value':value}|xmlattr }} {{ 'selected' if value in wid.selected }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
239 {{- label -}} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
240 </option> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
241 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
242 </select> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
243 {% else %} |
66 | 244 <div class="xmlui_widget xmlui_list" {{ {'id':id}|xmlattr }}> |
53
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
245 {% for value,label in wid.items %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
246 <span class="xmlui_list_item value_{{value|attr_escape}}"> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
247 {{- label -}} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
248 </span> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
249 {% endfor %} |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
250 </div> |
dfef430a26ef
input(xmlui): added a macro to generate a table from list of XMLUI items + many improvments in item generation (see docstrings)
Goffi <goffi@goffi.org>
parents:
47
diff
changeset
|
251 {% endif %} |
47
7d5cca978eeb
input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
252 {% endmacro%} |