From a8f7251b34b9af67aaa8ed6ad7d130a6c0d7164e Mon Sep 17 00:00:00 2001
From: rxdn <29165304+rxdn@users.noreply.github.com>
Date: Thu, 26 Nov 2020 18:28:16 +0000
Subject: [PATCH] Use modals instead of toasts
---
public/templates/views/panels.tmpl | 14 +++++++-------
public/templates/views/settings.tmpl | 24 ++++++++++++------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/public/templates/views/panels.tmpl b/public/templates/views/panels.tmpl
index 0acbc12..7f41189 100644
--- a/public/templates/views/panels.tmpl
+++ b/public/templates/views/panels.tmpl
@@ -252,12 +252,12 @@
const res = await axios.delete('/api/{{.guildId}}/panels/' + messageId);
if (res.status === 200 && res.data.success) {
- showToast('Success', 'Panel deleted successfully');
+ notifySuccess('Panel deleted successfully');
const el = document.getElementById(messageId);
el.parentNode.removeChild(el);
} else {
- showToast('Error', res.data.error);
+ notifyError(res.data.error);
}
}
@@ -295,9 +295,9 @@
if (res.status === 200 && res.data.success) {
data.message_id = res.data.message_id;
appendPanel(data, await getChannels());
- showToast('Success', 'Panel created successfully')
+ notifySuccess('Panel created successfully')
} else {
- showToast('Error', res.data.error);
+ notifyError(res.data.error);
}
}
@@ -437,7 +437,7 @@
async function fillPanels(channels) {
const res = await axios.get('/api/{{.guildId}}/panels');
if (res.status !== 200) {
- showToast("Error", res.data);
+ notifyError(res.data);
return 0;
}
@@ -454,7 +454,7 @@
async function fillMultiPanels() {
const res = await axios.get('/api/{{.guildId}}/multipanels');
if (res.status !== 200) {
- showToast("Error", res.data);
+ notifyError(res.data);
return;
}
@@ -488,7 +488,7 @@
// roles
const res = await axios.get('/api/{{.guildId}}/roles');
if (res.status !== 200 || !res.data.success) {
- showToast("Error", res.data);
+ notifyError(res.data);
return;
}
diff --git a/public/templates/views/settings.tmpl b/public/templates/views/settings.tmpl
index 8a3f0fe..11d5bb1 100644
--- a/public/templates/views/settings.tmpl
+++ b/public/templates/views/settings.tmpl
@@ -373,9 +373,9 @@
const res = await axios.post('/api/{{.guildId}}/claimsettings', data);
if (res.status === 200 && res.data.success) {
- showToast("Success", "Your settings have been saved.");
+ notifySuccess("Your settings have been saved.");
} else {
- showToast("Error", res.data.error);
+ notifyError(res.data.error);
}
}
@@ -439,11 +439,11 @@
const res = await axios.post('/api/{{.guildId}}/autoclose', data);
if (res.status !== 200 || !res.data.success) {
- showToast('Error', res.data.error);
+ notifyError(res.data.error);
return;
}
- showToast('Success', 'Auto close settings updated');
+ notifySuccess('Auto close settings updated');
}
@@ -466,10 +466,10 @@
if (res.status === 200) {
const success = showValidations(res.data);
if (success) {
- showToast("Success", "Your settings have been saved.");
+ notifySuccess("Your settings have been saved.");
}
} else {
- showToast("Error", "A severe error occurred. Please check your console for more information.");
+ notifyError("A severe error occurred. Please check your console for more information.");
console.log(res);
}
}
@@ -479,32 +479,32 @@
if (!data.prefix) {
success = false;
- showToast("Warning", "Your prefix has not been saved.
Prefixes must be between 1 - 8 characters in length.")
+ notify("Warning", "Your prefix has not been saved.
Prefixes must be between 1 - 8 characters in length.")
}
if (!data.welcome_message) {
success = false;
- showToast("Warning", "Your welcome message has not been saved.
Welcome messages must be between 1 - 1000 characters in length.")
+ notify("Warning", "Your welcome message has not been saved.
Welcome messages must be between 1 - 1000 characters in length.")
}
if (!data.ticket_limit) {
success = false;
- showToast("Warning", "Your ticket limit has not been saved.
Ticket limits must be in the range 1 - 10.")
+ notify("Warning", "Your ticket limit has not been saved.
Ticket limits must be in the range 1 - 10.")
}
if (!data.archive_channel) {
success = false;
- showToast("Warning", "Your archive channel has not been saved.")
+ notify("Warning", "Your archive channel has not been saved.")
}
if (!data.category) {
success = false;
- showToast("Warning", "Your channel category has not been saved.")
+ notify("Warning", "Your channel category has not been saved.")
}
if (!data.naming_scheme) {
success = false;
- showToast("Warning", "Your archive channel has not been saved.")
+ notify("Warning", "Your archive channel has not been saved.")
}
return success;