show a different message for custom domain alias when deleting
This commit is contained in:
parent
8b234b63a5
commit
f0fb5108f9
|
@ -432,6 +432,9 @@
|
||||||
|
|
||||||
<span class="btn btn-link btn-sm float-right text-danger"
|
<span class="btn btn-link btn-sm float-right text-danger"
|
||||||
onclick="confirmDeleteAlias.call(this)"
|
onclick="confirmDeleteAlias.call(this)"
|
||||||
|
{% if alias.custom_domain %}
|
||||||
|
data-custom-domain-trash-url="{{ alias.custom_domain.get_trash_url() }}"
|
||||||
|
{% endif %}
|
||||||
data-alias="{{ alias.id }}"
|
data-alias="{{ alias.id }}"
|
||||||
data-alias-email="{{ alias.email }}"
|
data-alias-email="{{ alias.email }}"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1684,6 +1684,9 @@ class CustomDomain(db.Model, ModelMixin):
|
||||||
def nb_alias(self):
|
def nb_alias(self):
|
||||||
return Alias.filter_by(custom_domain_id=self.id).count()
|
return Alias.filter_by(custom_domain_id=self.id).count()
|
||||||
|
|
||||||
|
def get_trash_url(self):
|
||||||
|
return URL + f"/dashboard/domains/{self.id}/trash"
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Custom Domain {self.domain}>"
|
return f"<Custom Domain {self.domain}>"
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,17 @@ $('.mailbox-select').multipleSelect();
|
||||||
function confirmDeleteAlias() {
|
function confirmDeleteAlias() {
|
||||||
let that = $(this);
|
let that = $(this);
|
||||||
let alias = that.data("alias-email");
|
let alias = that.data("alias-email");
|
||||||
|
let aliasDomainTrashUrl = that.data("custom-domain-trash-url");
|
||||||
|
|
||||||
|
let message = `Maybe you want to disable the alias instead? Please note once deleted, it <b>can't</b> be restored.`;
|
||||||
|
if (aliasDomainTrashUrl !== undefined) {
|
||||||
|
message = `Maybe you want to disable the alias instead? When it's deleted, it's moved to the domain
|
||||||
|
<a href="${aliasDomainTrashUrl}">trash</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
bootbox.dialog({
|
bootbox.dialog({
|
||||||
title: `Delete ${alias}`,
|
title: `Delete ${alias}`,
|
||||||
message: `Maybe you want to disable the alias instead? Please note once deleted, it <b>can't</b> be restored.`,
|
message: message,
|
||||||
size: 'large',
|
size: 'large',
|
||||||
onEscape: true,
|
onEscape: true,
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
|
|
Loading…
Reference in New Issue