{# One field, saying whether it is required and, when it is not, what empty becomes: as the field's placeholder, worded as its default, so it takes no line of its own. A field whose name alone does not say enough has an info tip beside its label. A field that takes files offers the browser's own picker - the native dialog of the computer the reader sits at, wherever kennis runs - as kennis's own buttons, with what was chosen said back beneath them, and leads with them: the typed path is folded away under them. Without a script the browser's own controls show, and still work. The Paper tab's ways in are a switch rather than a field: one is always chosen, so it has no heading saying it is required. A field `when` one of them shows only while that way is chosen, by the radios' own state, so it holds without a script. #} {% from "tip.html" import tip %} {% from "forms/add-input.html" import typed_input with context %} {% macro picker(field) %} {% if field.upload == "both" %}{% endif %} {{ tip("upload-" ~ field.name, upload_files, upload_hint) }} {% endmacro %} {% set typed %}{{ typed_input(field) }}{% endset %} {% if field.widget == "ways" %}
{% for choice in field.choices %}{% endfor %}
{% else %}
{% if field.widget == "choice" or field.upload %}{{ field.label }}{% else %}{% endif %} {% if field.name in field_tips %}{{ tip("field-" ~ field.name, field.label, field_tips[field.name]) }}{% endif %} {% if field.required %}{{ required }}{% else %}{{ optional }}{% endif %} {% if field.widget == "choice" %} {% for choice in field.choices %}{% endfor %} {% elif field.upload %} {% set typed_words = upload_typed if field.upload == "both" else upload_typed_pdf %} {{ picker(field) }}
{{ typed_words }} {{ typed }}
{% elif field.widget == "flag" %} {% if field.empty %}{{ empty_prefix }} {{ field.empty }}{% endif %} {% else %} {% if field.name == "identifiers" and field.when %}{{ icon("wand-sparkles") }}{% endif %}{{ typed }} {% endif %}
{% endif %}