Fix mail_domain from the server

This commit is contained in:
traxys 2023-10-09 13:41:13 +02:00
parent e8e9e9df8c
commit 1563a1aea0
2 changed files with 44 additions and 26 deletions

View file

@ -39,7 +39,7 @@
</div>
</div>
{% endmacro delete_modal %}
{% macro add_modal(modal_id, add_button, add_text, action, payload, button_classes, input_name, prefill=false) %}
{% macro add_modal(modal_id, add_button, add_text, action, payload, button_classes, input_name, fixed_domain=false) %}
<button type="button"
class="btn btn-primary {{ button_classes }}"
data-bs-toggle="modal"
@ -65,15 +65,26 @@
name="{{ payload | nth(n=idx*2) }}"
value="{{ payload | nth(n=idx*2 + 1) }}" />
{% endfor %}
<div class="form-floating mb-3">
<input type="email"
class="form-control"
id="{{ modal_id }}Input"
{% if prefill %} placeholder="mail@{{ mail_domain }}" {% else %} placeholder="mail@example.com" {% endif %}
name="{{ input_name }}"
{% if prefill %}value="@{{ mail_domain }}"{% endif %}>
<label for="{{ modal_id }}Input">Email address</label>
</div>
{% if fixed_domain %}
<div class="input-group">
<input type="text"
class="form-control"
placeholder="Mail"
aria-label="Mail"
aria-describedby="{{ modal_id }}Label"
name="{{ input_name }}" />
<span class="input-group-text" id="{{ modal_id }}Label">@{{ mail_domain }}</span>
</div>
{% else %}
<div class="form-floating mb-3">
<input type="email"
class="form-control"
id="{{ modal_id }}Input"
placeholder="mail@example.com"
name="{{ input_name }}" />
<label for="{{ modal_id }}Input">Email address</label>
</div>
{% endif %}
</form>
</div>
<div class="modal-footer">
@ -125,10 +136,10 @@
payload=["mail", mail.primary])
}}
</div>
<h3>Aliases</h3>
<ul class="list-group mt-1">
<h3>Aliases</h3>
<ul class="list-group mt-1">
{% set alias_idx = loop.index %}
{% for alias in mail.aliases %}
{% for alias in mail.aliases %}
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ alias }}
{{ self::delete_modal(modal_id="aliasDelete" ~ alias_idx ~ loop.index,
@ -137,16 +148,17 @@
payload=["mail", alias])
}}
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
{{ self::add_modal(modal_id="addAlias" ~ loop.index,
add_button="Add Alias",
button_classes="mt-2 w-25",
add_text="Add a alias",
action="/alias/add",
input_name="alias",
payload=["mail", mail.primary])
}}
payload=["mail", mail.primary],
fixed_domain=true)
}}
</li>
{% endfor %}
</ul>
@ -157,7 +169,7 @@
action="/mail/add",
input_name="mail",
payload=[],
prefill=true)
fixed_domain=true)
}}
<h2 class="title is-2 mt-2">Lists</h2>
<ul class="list-group">
@ -203,7 +215,7 @@
action="/list/add",
input_name="mail",
payload=[],
prefill=true)
fixed_domain=true)
}}
</div>
</div>