Remove drag and drop library

This hasn't been updated in 7 years (!) and will be replaced anyway.
This commit is contained in:
Roland Geider
2024-11-14 13:53:53 +01:00
parent f5ea59a74f
commit 20a56f2f86
5 changed files with 114 additions and 188 deletions

View File

@@ -10,7 +10,6 @@
},
"homepage": "https://github.com/wger-project/wger",
"dependencies": {
"Sortable": "RubaXa/Sortable#1.15.3",
"bootstrap": "5.3.3",
"components-font-awesome": "5.9.0",
"d3": "^7.9.0",

View File

@@ -27,55 +27,52 @@
/* font-face kit by Fonts2u - http://www.fonts2u.com */
@font-face {
font-family: "Open Sans Light";
src:
url("/static/fonts/OpenSans-Light.eot?") format("eot"),
font-family: "Open Sans Light";
src: url("/static/fonts/OpenSans-Light.eot?") format("eot"),
url("/static/fonts/OpenSans-Light.woff") format("woff"),
url("/static/fonts/OpenSans-Light.ttf") format("truetype"),
url("/static/fonts/OpenSans-Light.svg#OpenSans-Light") format("svg");
font-weight: normal;
font-style: normal;
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Open Sans";
src:
url("/static/fonts/OpenSans-Regular.eot?") format("eot"),
font-family: "Open Sans";
src: url("/static/fonts/OpenSans-Regular.eot?") format("eot"),
url("/static/fonts/OpenSans-Regular.woff") format("woff"),
url("/static/fonts/OpenSans-Regular.ttf") format("truetype"),
url("/static/fonts/OpenSans-Regular.svg#OpenSans") format("svg");
font-weight: normal;
font-style: normal;
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Open Sans Bold";
src:
url("/static/fonts/OpenSans-Bold.eot?") format("eot"),
font-family: "Open Sans Bold";
src: url("/static/fonts/OpenSans-Bold.eot?") format("eot"),
url("/static/fonts/OpenSans-Bold.woff") format("woff"),
url("/static/fonts/OpenSans-Bold.ttf") format("truetype"),
url("/static/fonts/OpenSans-Bold.svg#OpenSans-Bold") format("svg");
font-weight: normal;
font-style: normal;
font-weight: normal;
font-style: normal;
}
/* sticky footer */
html {
position: relative;
min-height: 100%;
position: relative;
min-height: 100%;
}
body {
margin-bottom: 5rem !important; /* Margin bottom by footer height */
margin-bottom: 5rem !important; /* Margin bottom by footer height */
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 4rem; /* Set the fixed height of the footer here */
position: absolute;
bottom: 0;
width: 100%;
height: 4rem; /* Set the fixed height of the footer here */
}
@@ -83,54 +80,36 @@ footer {
* Images in links are vertically aligned
*/
a img {
vertical-align: middle;
vertical-align: middle;
}
/*
* "invisible" elements, simply hidden (they still take all the space)
*/
.invisible {
display: none;
display: none;
}
.align-right {
text-align: right;
text-align: right;
}
.sortable-settings {
border: 1px solid black;
}
.sortable-settings-drag {
padding-left: 1em;
padding-right: 1em;
background-color: #babdb6;
border-bottom: 1px solid black;
}
/*
* Set a more appropriate cursor to the drag'n'drop handle on the
* workout view
*/
.dragndrop-handle {
cursor: move;
}
/*
* Set the sizes for the background where the muscles are shown on the exercise view page
*/
div.muscle-background {
width: 150px;
height: 276px;
background-size: 150px;
background-repeat: no-repeat;
width: 150px;
height: 276px;
background-size: 150px;
background-repeat: no-repeat;
}
/*
* Set an additional padding to the generated DIV on the edit set page
*/
#exercise-search-log {
padding-left: 1em;
padding-left: 1em;
}
@@ -142,13 +121,13 @@ div.muscle-background {
* Hide the edit options (edit, delete) on tables, only show them when the mouse is over the row
*/
.editoptions {
visibility: hidden;
visibility: hidden;
}
ul:hover .editoptions,
tr:hover .editoptions,
tbody tr:hover td .editoptions {
visibility: visible;
visibility: visible;
}
/*
@@ -160,7 +139,7 @@ tbody tr:hover td .editoptions {
.ajax-exercise-select a:hover,
.no-hover a:hover,
.no-hover:hover {
background-color: transparent;
background-color: transparent;
}
@@ -168,7 +147,7 @@ tbody tr:hover td .editoptions {
* Make more space for the page title
*/
#page-title {
margin-top: 0.5em;
margin-top: 0.5em;
}
/*
@@ -184,9 +163,9 @@ div.warning a:hover,
div.warning a:active,
div.info a:hover,
div.info a:active {
color: black;
text-decoration: underline;
background-color: transparent;
color: black;
text-decoration: underline;
background-color: transparent;
}
/**************************************************************
@@ -197,30 +176,30 @@ div.info a:active {
* Category heading for the ajax autocompleter
*/
.ui-autocomplete-category {
margin: 0;
text-align: center;
zoom: 1;
width: 100%;
font-weight: bold;
background-color: #d3d7cf;
border-bottom: 1px solid #888a85;
margin: 0;
text-align: center;
zoom: 1;
width: 100%;
font-weight: bold;
background-color: #d3d7cf;
border-bottom: 1px solid #888a85;
}
/*
* Give the result list from the autocompleter a maximum size
*/
.ui-autocomplete {
max-height: 500px;
max-width: 500px;
overflow-y: auto;
overflow-x: hidden; /* prevent horizontal scrollbar */
max-height: 500px;
max-width: 500px;
overflow-y: auto;
overflow-x: hidden; /* prevent horizontal scrollbar */
}
/*
* Give odd child's a different background colour (thanks CSS3!)
*/
.ui-autocomplete li.ui-menu-item:nth-child(odd) {
background: #eeeeec;
background: #eeeeec;
}
/**************************************************************
@@ -228,197 +207,196 @@ div.info a:active {
**************************************************************/
.extra-bold {
font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
font-weight: 300;
font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
font-weight: 300;
}
/**************************************************************
* Styling for the SVG elements on the weight chart
**************************************************************/
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.area {
fill: lightsteelblue;
fill: lightsteelblue;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}
.dot {
fill: white;
stroke: steelblue;
stroke-width: 1.5px;
fill: white;
stroke: steelblue;
stroke-width: 1.5px;
}
circle {
cursor: pointer;
cursor: pointer;
}
circle:hover {
fill: #204a87;
stroke: #204a87;
fill: #204a87;
stroke: #204a87;
}
.brush .extent {
stroke: #fff;
fill-opacity: 0.125;
shape-rendering: crispEdges;
stroke: #fff;
fill-opacity: 0.125;
shape-rendering: crispEdges;
}
/* Color series from d3.scale.category10() */
circle.color-1f77b4:hover {
fill: #1f77b4;
fill: #1f77b4;
}
circle.color-ff7f0e:hover {
fill: #ff7f0e;
fill: #ff7f0e;
}
circle.color-2ca02c:hover {
fill: #2ca02c;
fill: #2ca02c;
}
circle.color-d62728:hover {
fill: #d62728;
fill: #d62728;
}
circle.color-9467bd:hover {
fill: #9467bd;
fill: #9467bd;
}
circle.color-8c564b:hover {
fill: #8c564b;
fill: #8c564b;
}
circle.color-e377c2:hover {
fill: #e377c2;
fill: #e377c2;
}
circle.color-7f7f7f:hover {
fill: #7f7f7f;
fill: #7f7f7f;
}
circle.color-bcbd22:hover {
fill: #bcbd22;
fill: #bcbd22;
}
circle.color-17becf:hover {
fill: #17becf;
fill: #17becf;
}
/**************************************************************
* Weight log calendar
**************************************************************/
table.month td {
width: 14.285%;
height: 4em;
text-align: center;
width: 14.285%;
height: 4em;
text-align: center;
}
table.month th.month {
text-align: center;
background-color: #eeeeec;
text-align: center;
background-color: #eeeeec;
}
table.month a.calendar-link {
height: 100%;
line-height: 1;
height: 100%;
line-height: 1;
}
table.month td.session-bad {
background-color: #f2dede;
background-color: #f2dede;
}
table.month td.session-bad:hover {
background-color: #c9302c;
background-color: #c9302c;
}
table.month td.session-neutral {
background-color: #f5f5f5;
background-color: #f5f5f5;
}
table.month td.session-neutral:hover {
background-color: #babdb6;
background-color: #babdb6;
}
table.month td.session-good {
background-color: #dff0d8;
background-color: #dff0d8;
}
table.month td.session-good:hover {
background-color: #449d44;
background-color: #449d44;
}
/*
* Autocompleter
*/
.autocomplete-wrapper {
margin: 44px auto 44px;
max-width: 600px;
margin: 44px auto 44px;
max-width: 600px;
}
.autocomplete-wrapper label {
display: block;
margin-bottom: 0.75em;
color: #3f4e5e;
font-size: 1.25em;
display: block;
margin-bottom: 0.75em;
color: #3f4e5e;
font-size: 1.25em;
}
.autocomplete-wrapper .text-field {
padding: 0 15px;
width: 100%;
height: 40px;
border: 1px solid #cbd3dd;
font-size: 1.125em;
padding: 0 15px;
width: 100%;
height: 40px;
border: 1px solid #cbd3dd;
font-size: 1.125em;
}
.autocomplete-wrapper ::-webkit-input-placeholder,
.autocomplete-wrapper ::-moz-placeholder,
.autocomplete-wrapper :-moz-placeholder,
.autocomplete-wrapper :-ms-input-placeholder {
color: #cbd3dd;
font-style: italic;
font-size: 18px;
color: #cbd3dd;
font-style: italic;
font-size: 18px;
}
.autocomplete-suggestions {
overflow: auto;
border: 1px solid #cbd3dd;
background: #fff;
overflow: auto;
border: 1px solid #cbd3dd;
background: #fff;
}
.autocomplete-suggestion {
overflow: hidden;
padding: 5px 15px 5px 22px;
white-space: nowrap;
overflow: hidden;
padding: 5px 15px 5px 22px;
white-space: nowrap;
}
.autocomplete-selected {
background: #f0f0f0;
background: #f0f0f0;
}
.autocomplete-suggestions strong {
color: #3465a4;
font-weight: bold;
color: #3465a4;
font-weight: bold;
}
.autocomplete-group {
background-color: #d3d7cf;
padding-left: 13px;
background-color: #d3d7cf;
padding-left: 13px;
}
.autocomplete-group strong {
color: black;
font-weight: bold;
color: black;
font-weight: bold;
}

View File

@@ -67,7 +67,6 @@
{% compress js %}
<script src="{% static 'yarn/jquery/dist/jquery.js' %}"></script>
<script src="{% static 'yarn/bootstrap/dist/js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'yarn/Sortable/Sortable.min.js' %}"></script>
<script src="{% static 'yarn/d3/dist/d3.js' %}"></script>
<script src="{% static 'yarn/popper.js/dist/umd/popper.js' %}"></script>
<script src="{% static 'yarn/devbridge-autocomplete/dist/jquery.autocomplete.min.js' %}">

View File

@@ -5,8 +5,6 @@
<script src="{% static 'yarn/datatables.net-bs5/js/dataTables.bootstrap5.js' %}" ></script>
<script>
$(document).ready( function () {
/* Make table sortable */
$('#main_member_list').DataTable({
paging: false,
bFilter: true,

View File

@@ -13,52 +13,6 @@
{% block title %}{{ schedule.name }}{% endblock %}
{% block header %}
<script type="text/javascript">
function init_sortable() {
$("#schedule-table").find("tbody").off();
var elements = document.getElementsByTagName('tbody');
$.each(elements, function (index, element) {
Sortable.create(element, {
handle: '.dragndrop-handle',
animation: 150,
onUpdate: function (event) {
$.each(($(event.from).children('tr')), function (index, tr_element) {
var tr_element = $(tr_element);
console.log(tr_element.data('id'));
// The last table element has no ID attribute (has only the
// 'add exercise' link
if (tr_element.data('id')) {
var step_pk = tr_element.data('id');
$.ajax({
url: '/api/v2/schedulestep/' + step_pk + '/',
type: 'PATCH',
data: {'order': index + 1}
}).done(function (data) {
// console.log(data);
});
}
});
// TODO: again, why do we need to do this twice. Otherwise, sometimes
// it doesn't get current data
var current_url = $("#current-url").data('currentUrl');
$.get(current_url);
$.get(current_url, function (data) {
$('#schedule-table').html($(data).find('#schedule-table').html());
init_sortable();
wgerFormModalDialog();
});
}
});
})
}
$(function () {
init_sortable();
});
</script>
{% endblock %}
{% block content %}
@@ -112,8 +66,6 @@
{% if is_owner %}
<td style="min-width: 6em;">
<span class="editoptions">
<span title="{% translate 'Move me' %}" class="dragndrop-handle {% fa_class 'bars' %}"></span>
<a href="{% url 'manager:step:edit' step.id %}"
title="{% translate 'Edit' %}"
class="wger-modal-dialog">