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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
{% macro input(field, multiple=False, class='form-control', inline=False, placeholder='') -%}
<div class="form-group{% if inline %} row{% endif %}">
{% if field.type != "SubmitField" %}
{% if inline %}
{{ field.label(class="col-3") }}
{% else %}
{{ field.label() }}
{% endif %}
{% endif %}
<div class="controls{% if inline %} col-9{% endif %}">
{% if multiple == True %}
{{ field(multiple=True, class=class, placeholder=placeholder) }}
{% else %}
{{ field(class=class, placeholder=placeholder) | safe }}
{% endif %}
{% if field.description %}
<small id="{{field.name}}_description"" class="form-text text-muted">{{ field.description }}</small>
{% endif %}
</div>
</div>
{% endmacro %}
{% macro submit(field, cancel=False, home=False) -%}
<div class="actions">
<button type="submit" class="btn btn-primary">{{ field.name }}</button>
{% if home %}
<a href="{{ url_for(".remind_password") }}" class="btn btn-link">{{ _("Can't remember the password?") }}</a>
{% endif %}
{% if cancel %}
<button type="reset" class="btn btn-light">{{ _("Cancel") }}</button>
{% endif %}
</div>
{% endmacro %}
{% macro authenticate(form, home=False) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.id) }}
{{ input(form.password) }}
{% if not home %}
{{ submit(form.submit, home=True) }}
{% endif %}
{% endmacro %}
{% macro admin(form) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.admin_password) }}
{{ submit(form.submit) }}
{% endmacro %}
{% macro create_project(form, home=False) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{% if not home %}
{{ input(form.id) }}
{% endif %}
{{ input(form.name) }}
{{ input(form.password) }}
{{ input(form.contact_email) }}
{% if not home %}
{{ submit(form.submit, home=True) }}
{% endif %}
{% endmacro %}
{% macro edit_project(form) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.name) }}
{{ input(form.password) }}
{{ input(form.contact_email) }}
<div class="actions">
<button class="btn btn-primary">{{ _("Edit the project") }}</button>
<a id="delete-project" style="color:red; margin-left:10px; cursor:pointer; ">{{ _("delete") }}</a>
</div>
{% endmacro %}
{% macro upload_json(form) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ form.file }}
<div class="actions">
<button class="btn btn-primary">{{ _("Import") }}</button>
</div>
{% endmacro %}
{% macro add_bill(form, edit=False, title=True) %}
<fieldset>
{% if title %}<legend>{% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %}</legend>{% endif %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.date, class="form-control", inline=True) }}
{{ input(form.what, inline=True) }}
{{ input(form.payer, inline=True, class="form-control custom-select") }}
{{ input(form.amount, inline=True) }}
{{ input(form.external_link, inline=True) }}
<div class="form-group row">
<label class="col-3" for="payed_for">{{ _("For whom?") }}</label>
<div class="controls col-9">
<ul id="payed_for" class="inputs-list">
<p><a href="#" id="selectall" onclick="selectCheckboxes(true)">{{ _("Select all") }}</a> | <a href="#" id="selectnone" onclick="selectCheckboxes(false)">{{_("Select none")}}</a></p>
{% for key, value, checked in form.payed_for.iter_choices() | sort(attribute='1') %}
<p class="form-check"><label for="payed_for-{{key}}" class="form-check-label"><input name="payed_for" type="checkbox" {% if checked %}checked{% endif %} class="form-check-input" value="{{key}}" id="payed_for-{{key}}"/><span>{{value}}</span></label></p>
{% endfor %}
</ul>
</div>
</div>
</fieldset>
<div class="actions">
{{ form.submit(class="btn btn-primary") }}
{% if not edit %} {{ form.submit2(class="btn btn-light") }}{% endif %}
</div>
{% endmacro %}
{% macro add_member(form) %}
{{ form.hidden_tag() }}
{% include "display_errors.html" %}
<div class="input-group">
<label class="sr-only" for="name">_("Add participant")</label>
{{ form.name(placeholder=_("Add participant"), class="form-control") }}
<div class="input-group-append">
<button class="btn btn-secondary input-group-addon" type="submit">{{ _("Add") }}</button>
</div>
</div>
{% endmacro %}
{% macro edit_member(form, title=True) %}
<fieldset>
{% if title %}<legend>{{ _("Edit this member") }}</legend>{% endif %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.name) }}
{{ input(form.weight) }}
</fieldset>
<div class="actions">
{{ form.submit(class="btn btn-primary") }}
</div>
{% endmacro %}
{% macro invites(form) %}
{{ form.hidden_tag() }}
{{ input(form.emails, placeholder=_('john.doe@example.com, mary.moe@site.com')) }}
<div class="actions">
<button class="btn btn-primary">{{ _("Send the invitations") }}</button>
</div>
{% endmacro %}
{% macro export_project(form) %}
<fieldset>
{{ form.hidden_tag() }}
{{ input(form.export_type) }}
{{ input(form.export_format) }}
</fieldset>
<div class="actions">
<button class="btn btn-primary">{{ _("Download") }}</button>
</div>
{% endmacro %}
{% macro remind_password(form) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.id) }}
{{ submit(form.submit) }}
{% endmacro %}
{% macro reset_password(form) %}
{% include "display_errors.html" %}
{{ form.hidden_tag() }}
{{ input(form.password) }}
{{ input(form.password_confirmation) }}
{{ submit(form.submit) }}
{% endmacro %}
|