annotate default/input/field.html @ 27:38328c57f3ef

field: added new text and textarea macros
author Goffi <goffi@goffi.org>
date Sat, 24 Jun 2017 20:23:40 +0200
parents 8fa2fd2e928e
children 0520b7c9dcc0
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">
20
8fa2fd2e928e default: added i18n support
Goffi <goffi@goffi.org>
parents: 18
diff changeset
4 <input id="{{'field'|next_gidx}}" type="radio" name="{{name}}" value="{{choice}}"{{" checked" if checked==choice}}><label for="{{'field'|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">
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
11 <label id="{{'field'|next_gidx}}">{{label}}</label><input id="{{'field'|cur_gidx}}" type="number" name="{{name}}" value="{{init}}" step="1" min="0"></label>
d4a8afa7b590 input/field: <label> is separated from <input>
Goffi <goffi@goffi.org>
parents: 10
diff changeset
12 </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
13 {% endmacro %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
14
27
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
15 {% macro text(name, label="", placeholder="") %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
16 <span class="form_input">
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
17 <label id="{{'field'|next_gidx}}">{{label}}</label><input id="{{'field'|cur_gidx}}" type="text" name="{{name}}" placeholder="{{placeholder}}"></label>
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
18 </span>
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
19 {% endmacro %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
20
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
21 {% macro textarea(name, rows=10, cols=50, placeholder='') %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
22 <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
23 {% endmacro %}
38328c57f3ef field: added new text and textarea macros
Goffi <goffi@goffi.org>
parents: 20
diff changeset
24
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
25 {% 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
26 <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
27 {% endmacro %}
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
28
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
29 {% macro submit() %}
20
8fa2fd2e928e default: added i18n support
Goffi <goffi@goffi.org>
parents: 18
diff changeset
30 <input type="submit" value="{{_("Send")}}">
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
diff changeset
31 {% endmacro %}