show send test and delete buttons

This commit is contained in:
Son NK 2019-11-17 11:21:52 +01:00
parent 517a2ffc47
commit 673b9e72ee
3 changed files with 40 additions and 34 deletions

View File

@ -21,7 +21,7 @@
<thead>
<tr>
<th>Activity</th>
<th>Website Email</th>
<th>Correspondent Email</th>
<th></th>
<th>Alias</th>
</tr>

View File

@ -9,11 +9,10 @@
{% block default_content %}
<div class="page-header row">
<h3 class="page-title col"
data-intro="Here, you find the list of all <b>email alias</b> created. <br><br>
Emails sent to an <b>alias</b> will be forwarded to your personal email. <br><br>
Please note that email alias is <b>NOT</b> temporary, meaning an alias works forever! <br><br>
Email alias is a great way to hide your personal email so feel free to
use it whenever possible, for ex on untrusted websites 😎">
data-intro="Here, you find the list of all <b>alias</b> created. <br><br>
Emails sent to an <b>alias</b> will be forwarded to your inbox. <br><br>
Alias is a great way to hide your personal email address so feel free to
use it whenever possible, for example on untrusted websites 😎">
Email Alias
</h3>
<form method="post" class="col text-right">
@ -42,7 +41,6 @@
title="Block/unblock an alias"></i>
</th>
<th>Actions</th>
<th>More</th>
</tr>
</thead>
@ -83,7 +81,7 @@
{% if loop.index ==1 %}
data-intro="By turning off an alias, emails sent to this alias will <b>NOT</b>
be forwarded to your personal email. <br><br>
be forwarded to your inbox. <br><br>
This should only be used with care as others might
not be able to reach you after ...
"
@ -108,34 +106,32 @@
Copy &nbsp; &nbsp; <i class="dropdown-icon fe fe-clipboard"></i>
</button>
{% endif %}
</div>
</td>
<td>
<div class="item-action dropdown">
<a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
<div class="dropdown-menu dropdown-menu-right">
{% if gen_email.enabled %}
<form method="post">
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-send"></i>
<input type="hidden" name="form-name" value="trigger-email">
<input type="hidden" name="gen-email-id"
value="{{ gen_email.id }}">
<span class="trigger-email"> Send email to alias </span>
</a>
</form>
{% endif %}
<div class="dropdown-divider"></div>
{% if gen_email.enabled %}
<form method="post">
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-trash"></i>
<input type="hidden" name="form-name" value="delete-email">
<input type="hidden" name="gen-email-id" value="{{ gen_email.id }}">
<span class="delete-email"> Delete </span>
</a>
<input type="hidden" name="form-name" value="trigger-email">
<input type="hidden" name="gen-email-id"
value="{{ gen_email.id }}">
<span class="trigger-email btn btn-secondary"
{% if alias_info.show_intro_test_send_email %}
data-intro="Send a test email to this alias, the email will arrive at your inbox."
{% endif %}
>
Test alias &nbsp; &nbsp;
<i class="dropdown-icon fe fe-send"></i>
</span>
</form>
</div>
{% endif %}
<form method="post">
<input type="hidden" name="form-name" value="delete-email">
<input type="hidden" name="gen-email-id" value="{{ gen_email.id }}">
<span class="delete-email btn btn-secondary"> Delete
&nbsp; &nbsp;
<i class="dropdown-icon fe fe-trash-2"></i>
</span>
</form>
</div>
</td>

View File

@ -19,6 +19,8 @@ class AliasInfo:
nb_blocked: int
nb_reply: int
show_intro_test_send_email: bool = False
@dashboard_bp.route("/", methods=["GET", "POST"])
@login_required
@ -146,4 +148,12 @@ def get_alias_info(user_id) -> [AliasInfo]:
gen_email=ge, nb_blocked=0, nb_forward=0, nb_reply=0
)
return list(aliases.values())
ret = list(aliases.values())
# only show intro on the first enabled alias
for alias in ret:
if alias.gen_email.enabled:
alias.show_intro_test_send_email = True
break
return ret