annotate default/input/xmlui.html @ 48:37fd11d71233

base: confirmation message can now be customised using "confirm" blog
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:48:41 +0200
parents 7d5cca978eeb
children dfef430a26ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
5 {% macro generate_container(cont) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6 {% if cont.type == 'vertical' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7 {{ vertical_container(cont) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8 {% elif cont.type == 'pairs' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9 {{ pairs_container(cont) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 {% elif cont.type == 'label' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11 {{ label_container(cont) }}
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
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 {% macro generate_widget(wid, id=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16 {% if wid.type == 'text' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
17 {{ text_widget(wid, id=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
18 {% elif wid.type == 'label' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19 {{ label_widget(wid) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
20 {% elif wid.type == 'string' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
21 {{ string_widget(wid, id=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
22 {% elif wid.type == 'textbox' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
23 {{ textbox_widget(wid, id=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
24 {% elif wid.type == 'list' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
25 {{ list_widget(wid, id=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26 {% endif %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29 {% macro generate_children(cont) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30 {% for child in cont.children %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31 {% if child.category == 'container' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
32 {{ generate_container(child) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
33 {% else %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
34 {{ generate_widget(child) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
35 {% endif %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
36 {% endfor %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
37
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
38 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
39
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
40 {% macro generate(xmlui) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
41 {{ generate_container(xmlui.main_cont) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
42 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
43
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
44 {# containers #}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
45
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
46 {% macro vertical_container(cont) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
47 <div class="xmlui_cont xmlui_cont_vertical">
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
48 {{ generate_children(cont) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
49 </div>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
50 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
51
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
52 {% macro pairs_container(cont) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
53 {# 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
54 <div class="xmlui_cont xmlui_cont_vertical">
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
55 {{ generate_children(cont) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
56 </div>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
57 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
58
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
59 {% macro label_container(cont) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
60 <div class="xmlui_cont xmlui_cont_vertical">
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
61 {% for child in cont.children %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
62 {% if loop.index is odd %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
63 {# label #}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
64 {% set id = 'widget'|next_gidx %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
65 {% if child.type == 'label' %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
66 {{ label_widget(child, for=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
67 {% endif %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
68 {% else %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
69 {# widget #}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
70 {% set id = 'widget'|cur_gidx %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
71 {{ generate_widget(child, id=id) }}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
72 {% endif %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
73 {% endfor %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
74 </div>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
75 {% endmacro %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
76
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
77
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
78 {# widgets #}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
79
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
80 {% macro text_widget(wid, id=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
81 <p class="xmlui_widget xmlui_text" {{ {'id':id}|xmlattr }}>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
82 {{wid.value}}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
83 </p>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
84 {% endmacro%}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
85
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
86 {% macro label_widget(wid, for=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
87 <label class="xmlui_widget xmlui_label"{{ {'for':for}|xmlattr }}>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
88 {{wid.value}}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
89 </label>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
90 {% endmacro%}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
91
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
92 {% macro string_widget(wid, id=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
93 <input class="xmlui_widget xmlui_string" type="text" {{ {'name':wid.name, 'id':id, 'value':wid.value}|xmlattr }}>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
94 {% endmacro%}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
95
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
96 {% macro textbox_widget(wid, id=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
97 <textarea class="xmlui_widget xmlui_textbox" rows="10" cols="50" {{ {'name':wid.name, 'id':id}|xmlattr }}>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
98 {{- wid.value -}}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
99 </textarea>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
100 {% endmacro%}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
101
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
102 {% macro list_widget(wid, id=none) %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
103 <select class="xmlui_widget xmlui_list"{{ {'name':wid.name, 'id':id}|xmlattr }}>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
104 {% for value,label in wid.options %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
105 <option {{ {'value':value}|xmlattr }} {{ 'selected' if value == wid.selected }}>{{label}}</option>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
106 {% endfor %}
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
107 </select>
7d5cca978eeb input/xmlui: XMLUI generation first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
108 {% endmacro%}