Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Change some settings on the sortable, to make it more friendly

Roland Geiderdc2016413d66
diff --git a/manager/static/css/yaml401/custom-yaml.css b/manager/static/css/yaml401/custom-yaml.css
index 819fa8a75..28ffd7b83 100644
--- a/manager/static/css/yaml401/custom-yaml.css
+++ b/manager/static/css/yaml401/custom-yaml.css
@@ -28,4 +28,18 @@ tr:hover div.editoptions, tbody tr:hover td div.editoptions
.align-right
{
text-align: right;
+}
+
+.sortable-settings
+{
+ border: 1px solid black;
+}
+
+.sortable-settings-drag
+{
+ padding-left: 1em;
+ padding-right: 1em;
+ background-color: #babdb6; /* #888a85;*/
+ /*text-align:center;*/
+ border-bottom:1px solid black;
}
\ No newline at end of file
diff --git a/manager/templates/workout/view.html b/manager/templates/workout/view.html
index ed880fb56..67bd0c855 100644
--- a/manager/templates/workout/view.html
+++ b/manager/templates/workout/view.html
@@ -13,6 +13,7 @@ $(document).ready(function() {
// Allow the sets to be sortable
$(".workout-table tbody").sortable({
handle: 'td.ym-g10',
+ revert: true,
update : function (event, ui) {
// Monkey around the HTML, till we find the IDs of the set and the day
@@ -31,6 +32,13 @@ $(document).ready(function() {
// Allow the settings within an exercise to be sortable
$(".settings-list").sortable({
+ placeholder: 'sortable-settings',
+ revert: true,
+ tolerance: 'pointer',
+ helper: function(event, ui) {
+ //return ui;
+ return $('<div class="sortable-settings-drag">' + ui.html() + '</div>');
+ },
update : function (event, ui) {
// returns something in the form "setting-1,setting-2,setting-3,"
order = $( this ).sortable('toArray');