mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-19 02:51:48 +02:00
Add Copy functionality and corresponding toasts
This commit is contained in:
parent
c9cbd24569
commit
b76fcfd8e4
@ -15,9 +15,12 @@
|
|||||||
<!-- Bootstrap-Tables -->
|
<!-- Bootstrap-Tables -->
|
||||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.css">
|
||||||
|
|
||||||
|
<!-- Bootstrap-Toaster-->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toaster/4.1.2/css/bootstrap-toaster.min.css"
|
||||||
|
integrity="sha512-kYPLvO+Bu+xttOhbQvxs9nx7XSdxrb2JexRxQ3CpJQ7EtmlkBsWyOjlinLgiLWeLxuupFYB4cPqLOo0gnBnzeQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||||
|
|
||||||
<!-- Bootstrap core CSS -->
|
<!-- Bootstrap core CSS -->
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
|
||||||
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
|
||||||
|
|
||||||
<!-- Custom styles for this template -->
|
<!-- Custom styles for this template -->
|
||||||
<link href="static/css/style.css" rel="stylesheet">
|
<link href="static/css/style.css" rel="stylesheet">
|
||||||
@ -88,16 +91,12 @@
|
|||||||
<!-- Bootstrap core JavaScript
|
<!-- Bootstrap core JavaScript
|
||||||
================================================== -->
|
================================================== -->
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js"
|
||||||
integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f" crossorigin="anonymous">
|
integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ=="
|
||||||
</script>
|
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
|
||||||
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
|
||||||
</script>
|
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
|
|
||||||
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
|
|
||||||
</script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"
|
||||||
integrity="sha256-4F7e4JsAJyLUdpP7Q8Sah866jCOhv72zU5E8lIRER4w=" crossorigin="anonymous">
|
integrity="sha256-4F7e4JsAJyLUdpP7Q8Sah866jCOhv72zU5E8lIRER4w=" crossorigin="anonymous">
|
||||||
</script>
|
</script>
|
||||||
@ -105,6 +104,9 @@
|
|||||||
<script
|
<script
|
||||||
src="https://unpkg.com/bootstrap-table@1.21.2/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js"></script>
|
src="https://unpkg.com/bootstrap-table@1.21.2/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js"></script>
|
||||||
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
|
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toaster/4.1.2/js/bootstrap-toaster.min.js"
|
||||||
|
integrity="sha512-Ur6jgeoP3jnn38C7oBzDqMLRb+wxG2PXLKqgx2vgQ1ePFvbJ28f9iQSJplHD0APFHELOeS/df+RPNeENFtLrYw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
{% block extrajs %}{% endblock %}
|
{% block extrajs %}{% endblock %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -59,7 +59,13 @@ function requestDeletionAsUser(id) {
|
|||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
bootbox.alert("Eintrag zurückgezogen!")
|
toast = {
|
||||||
|
title: "Erfolgreich zurückgezogen",
|
||||||
|
message: "Eintrag wurde gelöscht",
|
||||||
|
status: TOAST_STATUS.SUCCESS,
|
||||||
|
timeout: 5000
|
||||||
|
}
|
||||||
|
Toast.create(toast);
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-field="state" data-checkbox="true"></th>
|
<th data-field="state" data-checkbox="true"></th>
|
||||||
<th scope="col" data-field="Name">Name</th>
|
<th scope="col" data-field="Name" data-formatter="CopyFormatter">Name</th>
|
||||||
<th scope="col" data-field="Title">Song</th>
|
<th scope="col" data-field="Title"data-formatter="CopyFormatter">Song</th>
|
||||||
<th scope="col" data-field="Artist">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>
|
||||||
@ -196,10 +196,26 @@
|
|||||||
return outerHTML;
|
return outerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CopyFormatter(value, row, index) {
|
||||||
|
return "<span data-toggle='tooltip' data-placement='right' title='📋' onclick='event.stopPropagation();$(this).tooltip(\"dispose\");copyAndNotify(\""+value+"\")'>"+value+"</span>";
|
||||||
|
}
|
||||||
|
|
||||||
function getIdSelections() {
|
function getIdSelections() {
|
||||||
return $.map($("#entrytable").bootstrapTable('getSelections'), function (row) {
|
return $.map($("#entrytable").bootstrapTable('getSelections'), function (row) {
|
||||||
return row.entry_ID
|
return row.entry_ID
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyAndNotify(text) {
|
||||||
|
navigator.clipboard.writeText(text).then(function () {
|
||||||
|
let toast = {
|
||||||
|
title: "Kopiert",
|
||||||
|
message: text,
|
||||||
|
status: 1,
|
||||||
|
timeout: 5000
|
||||||
|
};
|
||||||
|
Toast.create(toast);
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -99,9 +99,13 @@
|
|||||||
enqueue(localStorage.getItem("clientId"),id, name, function (response) {
|
enqueue(localStorage.getItem("clientId"),id, name, function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
entryID = response["entry_id"];
|
entryID = response["entry_id"];
|
||||||
bootbox.alert({
|
toast = {
|
||||||
message: "Deine Eintragung wurde erfolgreich vorgenommen.",
|
title: "Erfolgreich eingetragen",
|
||||||
});
|
message: "Du wurdest erfolgreich eingetragen.",
|
||||||
|
status: TOAST_STATUS.SUCCESS,
|
||||||
|
timeout: 5000
|
||||||
|
}
|
||||||
|
Toast.create(toast);
|
||||||
console.log("Entry ID: " + entryID);
|
console.log("Entry ID: " + entryID);
|
||||||
addEntry(entryID);
|
addEntry(entryID);
|
||||||
$("#enqueueModal").modal('hide');
|
$("#enqueueModal").modal('hide');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user