use bootbox instead of notie

This commit is contained in:
Son NK 2020-04-30 22:37:39 +02:00
parent 1be3297551
commit 7277c30735
10 changed files with 173 additions and 66 deletions

View file

@ -84,7 +84,7 @@
<form method="post">
<input type="hidden" name="form-name" value="delete">
<input type="hidden" name="contact-id" value="{{ contact.id }}">
<span class="card-link btn btn-link float-right delete-forward-email">
<span class="card-link btn btn-link float-right delete-forward-email text-danger">
Delete
</span>
</form>
@ -101,16 +101,28 @@
{% block script %}
<script>
$(".delete-forward-email").on("click", function (e) {
notie.confirm({
text: "Activity history associated with this reverse-alias will be deleted, " +
" please confirm.",
cancelCallback: () => {
// nothing to do
let that = $(this);
bootbox.confirm({
message: "All activities associated with this reverse-alias will also be deleted, please confirm.",
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>
{% endblock %}

View file

@ -104,16 +104,28 @@
{% block script %}
<script>
$(".delete-api-key").on("click", function (e) {
notie.confirm({
text: "If this api key is currently in use, you need to replace it with another api key, " +
" please confirm.",
cancelCallback: () => {
// nothing to do
let that = $(this);
bootbox.confirm({
message: "If this api key is currently in use, you need to replace it with another api key, please confirm.",
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
$(".toggle-api-key").on('click', function (event) {

View file

@ -87,15 +87,26 @@
<script>
$(".cancel").on("click", function (e) {
notie.confirm({
text: `This operation is irreversible, please confirm`,
cancelCallback: () => {
// nothing to do
let that = $(this);
bootbox.confirm({
message: "This operation is irreversible, please confirm.",
buttons: {
confirm: {
label: 'Cancel subscription',
className: 'btn-danger'
},
cancel: {
label: 'Close',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>

View file

@ -20,7 +20,8 @@
{% endif %}
<div class="alert alert-primary" role="alert">
If you own a domain, let's say <b>example.com</b>, you will be able to create aliases with this domain, for example
If you own a domain, let's say <b>example.com</b>, you will be able to create aliases with this domain, for
example
contact@example.com, help@example.com, etc with SimpleLogin. <br>
You could also enable <b>catch-all</b> feature that allows you to create aliases on-the-fly.
</div>

View file

@ -107,16 +107,30 @@
<script>
$(".delete-dir").on("click", function (e) {
let directory = $(this).parent().find(".dir-name").val();
notie.confirm({
text: `All aliases associated with <b>${directory}</b> directory will be also deleted, ` +
" please confirm.",
cancelCallback: () => {
// nothing to do
let that = $(this);
let message = `All aliases associated with <b>${directory}</b> directory will also be deleted, ` +
" please confirm.";
bootbox.confirm({
message: message,
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>
{% endblock %}

View file

@ -54,7 +54,7 @@
<hr>
<h3 class="mb-0">Delete Domain</h3>
<div class="small-text mb-3">Please note that this operation is irreversible.
All aliases associated with this domain will be also deleted
All aliases associated with this domain will be also deleted.
</div>
<form method="post">
@ -71,16 +71,27 @@
});
$(".delete-custom-domain").on("click", function (e) {
notie.confirm({
text: "All aliases associated with <b>{{ custom_domain.domain }}</b> will be also deleted, " +
let that = $(this);
bootbox.confirm({
message: "All aliases associated with <b>{{ custom_domain.domain }}</b> will be also deleted, " +
" please confirm.",
cancelCallback: () => {
// nothing to do
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>
{% endblock %}

View file

@ -483,7 +483,6 @@
{% block script %}
<script>
var clipboard = new ClipboardJS('.clipboard');
{% if show_intro %}
// only show intro when screen is big enough to show "developer" tab
@ -494,17 +493,31 @@
$(".delete-email").on("click", function (e) {
let alias = $(this).parent().find(".alias").val();
notie.confirm({
text: `Once <b>${alias}</b> is deleted, people/apps ` +
"who used to contact you via this alias cannot reach you any more," +
" please confirm.",
cancelCallback: () => {
// nothing to do
let message = `Once <b>${alias}</b> is deleted, people/apps ` +
"who used to contact you via this alias cannot reach you any more," +
" please confirm.";
let that = $(this);
bootbox.confirm({
message: message,
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
$(".custom-switch-input").change(async function (e) {

View file

@ -123,16 +123,29 @@
<script>
$(".delete-mailbox").on("click", function (e) {
let mailbox = $(this).parent().find(".mailbox").val();
notie.confirm({
text: `All aliases owned by this mailbox <b>${mailbox}</b> will be also deleted, ` +
" please confirm.",
cancelCallback: () => {
// nothing to do
let that = $(this);
let message = `All aliases owned by this mailbox <b>${mailbox}</b> will be also deleted, ` +
" please confirm.";
bootbox.confirm({
message: message,
buttons: {
confirm: {
label: 'Yes, delete it',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>
{% endblock %}

View file

@ -306,17 +306,29 @@
{% block script %}
<script>
$(".delete-account").on("click", function (e) {
notie.confirm({
text: "All your data including your aliases will be deleted, " +
let that = $(this);
bootbox.confirm({
message: "All your data including your aliases will be deleted, " +
"other people might not be able to reach you after, " +
" please confirm.",
cancelCallback: () => {
// nothing to do
buttons: {
confirm: {
label: 'Yes, delete my account',
className: 'btn-danger'
},
cancel: {
label: 'Cancel',
className: 'btn-outline-primary'
}
},
submitCallback: () => {
$(this).closest("form").submit();
callback: function (result) {
if (result) {
that.closest("form").submit();
}
}
});
})
});
</script>
{% endblock %}

View file

@ -62,6 +62,8 @@
<link rel="stylesheet" href="{{ url_for('static', filename='node_modules/toastr/build/toastr.min.css') }}">
<script src="{{ url_for('static', filename='node_modules/toastr/build/toastr.min.js') }}"></script>
<script src="{{ url_for('static', filename='node_modules/bootbox/dist/bootbox.min.js') }}"></script>
<link rel="stylesheet" type="text/css" href="/static/style.css?v={{ VERSION }}">
<script>
@ -151,6 +153,12 @@
overlayClickDismiss: false,
});
// default options for bootbox
bootbox.setDefaults({
closeButton: false,
backdrop: true
})
var clipboard = new ClipboardJS('.clipboard');
clipboard.on('success', function (e) {