Add cheese to all toasts.

This commit is contained in:
Stephan Porada 2020-01-17 15:10:11 +01:00
parent e5928731ec
commit cc52744109

View File

@ -233,13 +233,7 @@
socket.emit("corpus_analysis", queryData); socket.emit("corpus_analysis", queryData);
queryLoadingElement.classList.remove("hide"); queryLoadingElement.classList.remove("hide");
queryResultsTableElement.classList.add("hide"); queryResultsTableElement.classList.add("hide");
let toast = M.toast({"html": `<span>Query has been sent!</span><button class="btn-flat toast-action red-text" data-action="close"><i class="material-icons">close</i></button>`}); toast("Query has been sent!")
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
}); });
socket.on("corpus_analysis", function(message) { socket.on("corpus_analysis", function(message) {
@ -256,23 +250,11 @@
if (message === null) { if (message === null) {
queryResultsTableElement.classList.add("hide"); queryResultsTableElement.classList.add("hide");
let toast = M.toast({"classes": "red", "html": `<span>No results for this query!</span><button class="btn-flat toast-action white-text" data-action="close"><i class="material-icons">close</i></button>`}); toast("No results for this query!")
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
return; return;
} else if (message === "CQI_CQP_ERROR_GENERAL") { } else if (message === "CQI_CQP_ERROR_GENERAL") {
queryResultsTableElement.classList.add("hide"); queryResultsTableElement.classList.add("hide");
let toast = M.toast({"classes": "red", "html": `<span>Invalid query entered!</span><button class="btn-flat toast-action white-text" data-action="close"><i class="material-icons">close</i></button>`}); toast("Invalid query entered!", "red");
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
return; return;
} else { } else {
total_nr_matches = message["total_nr_matches"]; total_nr_matches = message["total_nr_matches"];