-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbase_form.html
More file actions
96 lines (90 loc) · 3.32 KB
/
base_form.html
File metadata and controls
96 lines (90 loc) · 3.32 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{%extends "base.html"%}
{%load commitfest%}
{%block contents%}
<form class="form-horizontal {{extraformclass}}" method="POST" action=".">{%csrf_token%}
{%if form.errors%}
<div class="alert">Please correct the errors below, and re-submit the form.</div>
{%endif%}
{%if form.non_field_errors%}
<div class="alert alert-danger">{{form.non_field_errors}}</div>
{%endif%}
{%if note%}
<div class="alert alert-info">{{note|safe}}</div>
{%endif%}
{%for field in form%}
{%if not field.is_hidden%}
<div class="form-group">
{{field|label_class:"control-label"}}
<div class="col-lg-12 controls">
{%if field.errors %}
{%for e in field.errors%}
<div class="alert alert-danger">{{e}}</div>
{%endfor%}
{%endif%}
{%if field.name|slice:":7" == 'review_' %}
{%for choice in field %}
<div class="form-check form-check-inline">
<input type="checkbox" class="form-check-input" name="{{field.name}}" value="{{choice.data.value}}" id="{{choice.id_for_label}}" {% if choice.data.selected %}checked{% endif %}>
<label class="form-check-label" for="{{choice.id_for_label}}">{{choice.choice_label}}</label>
</div>
{%endfor%}
{%elif not field.name in form.selectize_fields%}{{field|field_class:"form-control"}}{%else%}{{field}}{%endif%}
{%if field.help_text%}<br/>{{field.help_text|safe}}{%endif%}</div>
</div>
{%else%}
{{field}}
{%endif%}
{%endfor%}
<div class="form-group">
<div class="col-lg-12">
<input type="submit" class="btn btn-primary" value="{{savebutton|default:"Save"}}">
</div>
</div>
</form>
{%if threadbrowse %}
{%include "thread_attach.inc" %}
{%endif%}
{%if user.is_staff%}
<div class="modal fade" id="searchUserModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Search user</h3>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form class="d-flex gap-2" style="margin-bottom: 5px;">
<div class="input-group">
<input id="searchUserSearchField" type="text" class="form-control" autocomplete="off">
<button id="searchUserSearchButton" onclick="return findUsers()" class="btn btn-outline-secondary">Search</button>
</div>
</form>
<div>Search for users above and then pick one in the list below:</div>
<div id="searchUserListWrap">
<select id="searchUserList" size="6" style="width:100%;" onchange="searchUserListChanged()"></select>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-outline-secondary" data-bs-dismiss="modal">Close</a>
<a href="#" id="doSelectUserButton" class="btn btn-primary disabled">Add user to system</a>
</div>
</div>
</div>
</div>
{%endif%}
{%endblock%}
{%block morescript%}
{%include "selectize_js.html" %}
<script>
{%if user.is_staff%}
$('.selectize-control.add-user-picker').after(
$('<a href="#" class="btn btn-outline-secondary btn-sm">Import user not listed</a>').click(function () {
search_and_store_user();
})
);
$('#searchUserModal').on('shown.bs.modal', function() {
$('#searchUserSearchField').focus();
});
{%endif%}
</script>
{%endblock%}