Dark theme Toast notifications

Fixes #59
This commit is contained in:
Phillip Kühne 2023-10-04 00:11:42 +00:00
parent 8c98edb604
commit e443cdb35a
Signed by: phillip
GPG Key ID: E4C1C4D2F90902AA
3 changed files with 67 additions and 51 deletions

View File

@ -24,6 +24,10 @@
/* Misc */ /* Misc */
--copy-highlight-color: rgba(251, 255, 0, 0.6); --copy-highlight-color: rgba(251, 255, 0, 0.6);
/* Toasts */
--toast-background-color: #ffffff;
--toast-text-color: #212529;
} }
@ -188,6 +192,16 @@ pre {
); );
} }
.toast {
background-color: var(--toast-background-color);
color: var(--toast-text-color);
}
.toast-header {
background-color: var(--toast-background-color);
color: var(--toast-text-color);
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
/* Navbar */ /* Navbar */
@ -212,5 +226,9 @@ pre {
/* Input */ /* Input */
--input-background-color: #343434; --input-background-color: #343434;
/* Toasts */
--toast-background-color: #232323;
--toast-text-color: #f5f5f5;
} }
} }

View File

@ -1,5 +1,3 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Warteliste{% endblock %} {% block title %}Warteliste{% endblock %}
{% block content %} {% block content %}
@ -25,27 +23,27 @@
{% endblock %} {% endblock %}
{% block extrajs %} {% block extrajs %}
<script> <script>
$.getJSON("/api/entries/accept", (data) => { $.getJSON("/api/entries/accept", (data) => {
if (data["value"]==0) { if (data["value"] == 0) {
$("#bfb").addClass("disabled") $("#bfb").addClass("disabled")
$("#bfb").prop("aria-disabled",true); $("#bfb").prop("aria-disabled", true);
$("#bfb").prop("tabindex","-1"); $("#bfb").prop("tabindex", "-1");
$("#bfb").wrap("<span class='tooltip-span' tabindex='0' data-toggle='tooltip' data-placement='bottom'></span>"); $("#bfb").wrap("<span class='tooltip-span' tabindex='0' data-toggle='tooltip' data-placement='bottom'></span>");
$(".tooltip-span").prop("title", "Eintragungen sind leider momentan nicht möglich.") $(".tooltip-span").prop("title", "Eintragungen sind leider momentan nicht möglich.")
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
} }
}) })
function TableActionsFormatter(value,row,index) { function TableActionsFormatter(value, row, index) {
console.log("Value: " + value + ", Row: " + row + ", Index: " + index) console.log("Value: " + value + ", Row: " + row + ", Index: " + index)
console.log(row) console.log(row)
if (getOwnedEntries().includes(row.entry_ID)) { if (getOwnedEntries().includes(row.entry_ID)) {
return "<button type='button' class='btn btn-danger' data-toggle='tooltip' data-placement='top' title='Eintrag zurückziehen' onclick=\"event.stopPropagation();$(this).tooltip('dispose');requestDeletionAsUser("+row["entry_ID"]+")\"><i class='fas fa-trash'></i></button>" return "<button type='button' class='btn btn-danger' data-toggle='tooltip' data-placement='top' title='Eintrag zurückziehen' onclick=\"event.stopPropagation();$(this).tooltip('dispose');requestDeletionAsUser(" + row["entry_ID"] + ")\"><i class='fas fa-trash'></i></button>"
} }
return "" return ""
} }
function requestDeletionAsUser(id) { function requestDeletionAsUser(id) {
bootbox.confirm("Wirklich den Eintrag zurückziehen? Das könnte zu einer langen Wartezeit führen!", function (result) { bootbox.confirm("Wirklich den Eintrag zurückziehen? Das könnte zu einer langen Wartezeit führen!", function (result) {
if (result) { if (result) {
payload = { payload = {
@ -53,12 +51,12 @@ function requestDeletionAsUser(id) {
"entry_id": id "entry_id": id
} }
$.ajax({ $.ajax({
url: "/api/entries/delete/"+id, url: "/api/entries/delete/" + id,
type: "POST", type: "POST",
data: JSON.stringify(payload), data: JSON.stringify(payload),
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
success: function(result) { success: function (result) {
toast = { toast = {
title: "Erfolgreich zurückgezogen", title: "Erfolgreich zurückgezogen",
message: "Eintrag wurde gelöscht", message: "Eintrag wurde gelöscht",
@ -71,7 +69,7 @@ function requestDeletionAsUser(id) {
}) })
} }
}) })
} }
</script> </script>
{% endblock %} {% endblock %}

View File

@ -27,8 +27,8 @@
<tr> <tr>
<th data-field="state" data-checkbox="true"></th> <th data-field="state" data-checkbox="true"></th>
<th scope="col" data-field="Name" data-formatter="CopyFormatter">Name</th> <th scope="col" data-field="Name" data-formatter="CopyFormatter">Name</th>
<th scope="col" data-field="Title"data-formatter="CopyFormatter">Song</th> <th scope="col" data-field="Title" data-formatter="CopyFormatter">Song</th>
<th scope="col" data-field="Artist"data-formatter="CopyFormatter">Künstler</th> <th scope="col" data-field="Artist" data-formatter="CopyFormatter">Künstler</th>
<th scope="col" data-formatter="TableActions">Aktionen</th> <th scope="col" data-formatter="TableActions">Aktionen</th>
</tr> </tr>
</thead> </thead>
@ -195,8 +195,8 @@
} }
function CopyFormatter(value, row, index) { function CopyFormatter(value, row, index) {
let escapedString = value.replace("\"","\\\"").replace("\'", "\\\'") let escapedString = value.replace("\"", "\\\"").replace("\'", "\\\'")
return "<span onclick='copyAndNotify(this.innerText)'>"+value+"</span>"; return "<span onclick='copyAndNotify(this.innerText)'>" + value + "</span>";
} }
function getIdSelections() { function getIdSelections() {