view default/input/field.html @ 47:7d5cca978eeb

input/xmlui: XMLUI generation first draft
author Goffi <goffi@goffi.org>
date Sun, 24 Sep 2017 16:48:15 +0200
parents 0520b7c9dcc0
children 87680eed9e25
line wrap: on
line source

{% macro choices(name, choices_list, checked=none) %}
    {% for choice, label in choices_list %}
        <div class="form_input">
            <input id="{{'field'|next_gidx}}" type="radio" name="{{name}}" value="{{choice}}"{{" checked" if checked==choice}}><label for="{{'field'|cur_gidx}}">{{label}}</label>
        </div>
    {% endfor %}
{% endmacro %}

{% macro int(name, label="", init=0) %}
    <span class="form_input">
        <label id="{{'field'|next_gidx}}">{{label}}</label><input id="{{'field'|cur_gidx}}" type="number" name="{{name}}" value="{{init}}" step="1" min="0"></label>
    </span>
{% endmacro %}

{% macro text(name, label="", placeholder="") %}
    <span class="form_input">
        <label id="{{'field'|next_gidx}}">{{label}}</label><input id="{{'field'|cur_gidx}}" type="text" name="{{name}}" placeholder="{{placeholder}}"></label>
    </span>
{% endmacro %}

{% macro textarea(name, rows=10, cols=50, placeholder='') %}
    <textarea name="{{name}}" rows="{{rows}}" cols="{{cols}}" placeholder="{{placeholder}}"></textarea>
{% endmacro %}

{% macro meta(name, value) %}
    <input type="hidden" name="{{name}}" value="{{value}}">
{% endmacro %}

{% macro submit(text=_("Send")) %}
    <input class="form_submit" type="submit" value="{{text}}">
{% endmacro %}