show alias in confirmation message

This commit is contained in:
Son NK 2019-12-26 17:37:51 +00:00
parent 41aee485bf
commit 65d0848e2f

View file

@ -115,8 +115,10 @@
{% endif %} {% endif %}
style="padding-left: 0px" style="padding-left: 0px"
> >
<input type="hidden" name="alias" class="alias" value="{{ gen_email.email }}">
<input type="checkbox" class="custom-switch-input" <input type="checkbox" class="custom-switch-input"
{{ "checked" if gen_email.enabled else "" }}> {{ "checked" if gen_email.enabled else "" }}>
<span class="custom-switch-indicator"></span> <span class="custom-switch-indicator"></span>
</label> </label>
</form> </form>
@ -143,6 +145,8 @@
<form method="post"> <form method="post">
<input type="hidden" name="form-name" value="delete-email"> <input type="hidden" name="form-name" value="delete-email">
<input type="hidden" name="gen-email-id" value="{{ gen_email.id }}"> <input type="hidden" name="gen-email-id" value="{{ gen_email.id }}">
<input type="hidden" name="alias" class="alias" value="{{ gen_email.email }}">
<span class="delete-email btn btn-link btn-sm float-right"> <span class="delete-email btn btn-link btn-sm float-right">
Delete&nbsp; &nbsp;<i class="dropdown-icon fe fe-trash-2"></i> Delete&nbsp; &nbsp;<i class="dropdown-icon fe fe-trash-2"></i>
</span> </span>
@ -248,9 +252,10 @@
$(".delete-email").on("click", function (e) { $(".delete-email").on("click", function (e) {
let alias = $(this).parent().find(".alias").val();
notie.confirm({ notie.confirm({
text: "Once an alias is deleted, people/apps " + text: `Once <b>${alias}</b> is deleted, people/apps ` +
"who used to contact you via this email address cannot reach you any more," + "who used to contact you via this alias cannot reach you any more," +
" please confirm.", " please confirm.",
cancelCallback: () => { cancelCallback: () => {
// nothing to do // nothing to do
@ -276,11 +281,12 @@
$(".custom-switch-input").change(function (e) { $(".custom-switch-input").change(function (e) {
var message = ""; var message = "";
let alias = $(this).parent().find(".alias").val();
if (e.target.checked) { if (e.target.checked) {
message = `After this, you will start receiving email sent to this alias, please confirm.`; message = `After this, you will start receiving email sent to <b>${alias}</b>, please confirm.`;
} else { } else {
message = `After this, you will stop receiving email sent to this alias, please confirm.`; message = `After this, you will stop receiving email sent to <b>${alias}</b>, please confirm.`;
} }
notie.confirm({ notie.confirm({