-
Notifications
You must be signed in to change notification settings - Fork 16
/
_field.html
74 lines (63 loc) · 2.84 KB
/
_field.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{% from "application_form/_value.html" import value %}
<div class="{{ f.name }}__container form__question {% if f.has_conditional %} form__subquestion {% endif %}">
<a id="question-{{ f.name }}"></a>
{% set label %}
<label for="{{ f.name }}">
{% autoescape off %}{{ f.label | safe }}{% endautoescape %}
{% if f.help("long_help") %}
<span class="form__long-help" data-feather="help-circle" aria-hidden="true" data-toggle="modal" data-target="#modal-{{ f.name }}"></span><span class="sr-only">More help</span>
{% endif %}
{% if f.has_widget("click_to_copy") %}
<span class="form__click-to-copy" id="click-to-copy--{{ f.name }}" data-feather="copy" aria-hidden="true"></span><span class="sr-only">Copy value</span>
<span class="tag tag--confirmation" style="display:none" id="copy-confirmation--{{ f.name }}">Copied!</span>
{% endif %}
{% if f.optional %}<span class="form__question--optional">(Optional)</span>{% endif %}
</label>
{% endset %}
{% if f.wtfield.__class__.__name__ != "BooleanField" %}
{{ label }}
{% endif %}
{% if f.help("short_help") %}
<p class="form__short-help"><small>{{ f.help("short_help") | safe }}</small></p>
{% endif %}
{% if f.get("hint") %}<p><small>{{ f.hint | safe }}</small></p>{% endif %}
{% if f.has_widget("multiple_field") or f.has_widget("infinite_repeat") %}
<div class="removable-fields" id="removable_field__{{ f.name }}">
{{ f.render_form_control() }}
<p class="add_field__button_div">
<button type="button" id="add_field__{{ f.name }}" class="add_field__button"><span data-feather="plus"></span> Add</button>
</p>
</div>
{% else %}
{{ f.render_form_control() }}
{% endif %}
{% if f.wtfield.__class__.__name__ == "BooleanField" %}
{{ label }}
{% endif %}
{% if f.help("render_error_box") != False %} {# some fields have custom error boxes #}
<div id="{{ f.name }}_checkbox-errors"></div>
{% endif %}
{% if form_diff %}
{% if f.help("update_requests_diff", True) and f.name in form_diff %}
<p class="alert alert--message">
<strong>WAS:</strong>
<em>
{{ value(form_diff[f.name].a, f.name, formulaic_context) }}
</em>
</p>
{% endif %}
{% endif %}
{% if f.wtfield.errors %}
<div class="backend_validation_errors">
<ul class="parsley-errors-list filled" aria-hidden="false">
{% for error in f.wtfield.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if f.widgets %}
<div id="{{ f.name }}_widgets-container" class="widgets-container"></div>
{% endif %}
</div>
{% include "application_form/modal.html" %}