annotate default/input/field.html @ 52:87680eed9e25

input(field, form): improved classes + new email field
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:54:01 +0200
parents 0520b7c9dcc0
children f76ec90e0e1e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
1 {% macro choices(name, choices_list, checked=none) %}
20
8fa2fd2e928e default: added i18n support
Goffi <goffi@goffi.org>
parents: 18
diff changeset
2 {% for choice, label in choices_list %}
18
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
3 <div class="form_input">
52
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
4 <input id="{{name|next_gidx}}" type="radio" name="{{name}}" value="{{choice}}"{{" checked" if checked==choice}}><label for="{{name|cur_gidx}}">{{label}}</label>
18
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
5 </div>
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
6 {% endfor %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
7 {% endmacro %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
8
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
9 {% macro int(name, label="", init=0) %}
18
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
10 <span class="form_input">
52
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
11 <label id="{{name|next_gidx}}">{{label}}</label><input id="{{name|cur_gidx}}" type="number" name="{{name}}" value="{{init}}" step="1" min="0">
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
12 </span>
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
13 {% endmacro %}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
14
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
15 {% macro text(name, label="", placeholder="", required=false) %}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
16 {# single line text field
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
17 additional kwargs will be passed as attributes #}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
18 <span class="form_input">
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
19 <label id="{{name|next_gidx}}">{{label}}</label><input id="{{name|cur_gidx}}" type="text" name="{{name}}" placeholder="{{placeholder}}" {{"required" if required}} {{kwargs|xmlattr}}>
18
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
20 </span>
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
21 {% endmacro %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
22
52
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
23 {% macro password(name, label="", required=false) %}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
24 {# password field
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
25 additional kwargs will be passed as attributes #}
27
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
26 <span class="form_input">
52
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
27 <label id="{{name|next_gidx}}">{{label}}</label><input id="{{name|cur_gidx}}" type="password" name="{{name}}" {{"required" if required}} {{kwargs|xmlattr}}>
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
28 </span>
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
29 {% endmacro %}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
30
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
31 {% macro email(name, label="", required=false) %}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
32 {# email field
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
33 additional kwargs will be passed as attributes #}
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
34 <span class="form_input">
87680eed9e25 input(field, form): improved classes + new email field
Goffi <goffi@goffi.org>
parents: 46
diff changeset
35 <label id="{{name|next_gidx}}">{{label}}</label><input id="{{name|cur_gidx}}" type="email" name="{{name}}" {{"required" if required}} {{kwargs|xmlattr}}>
27
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
36 </span>
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
37 {% endmacro %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
38
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
39 {% macro textarea(name, rows=10, cols=50, placeholder='') %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
40 <textarea name="{{name}}" rows="{{rows}}" cols="{{cols}}" placeholder="{{placeholder}}"></textarea>
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
41 {% endmacro %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
42
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
43 {% macro meta(name, value) %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
44 <input type="hidden" name="{{name}}" value="{{value}}">
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
45 {% endmacro %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
46
46
0520b7c9dcc0 input/field: text can be specified for submit button
Goffi <goffi@goffi.org>
parents: 27
diff changeset
47 {% macro submit(text=_("Send")) %}
0520b7c9dcc0 input/field: text can be specified for submit button
Goffi <goffi@goffi.org>
parents: 27
diff changeset
48 <input class="form_submit" type="submit" value="{{text}}">
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
49 {% endmacro %}