Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

It seems it's necessary to duplicate the js code for the exercise widget

Roland Geiderdfcd47cbd160
diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.js
index 67d6eb56e..e00c2a77d 100644
--- a/manager/static/js/workout-manager.js
+++ b/manager/static/js/workout-manager.js
@@ -400,14 +400,22 @@ function init_edit_set()
// Add the exercise to the list
add_exercise(ui.item);
+ // Remove the result div (also contains the hidden form element) when the user
+ // clicks on the delete link
+ $(".ajax-exercise-select a").click(function(e) {
+ e.preventDefault();
+ $(this).parent('div').remove();
+ });
+
// Reset the autocompleter
$(this).val("");
return false;
}
});
- // Remove the result div (also contains the hidden form element) when the user
- // clicks on the delete link
+ // Remove the result div again
+ // TODO: it seems it's necessary to have this twice, see if there's a better
+ // way to handle it
$(".ajax-exercise-select a").click(function(e) {
e.preventDefault();
$(this).parent('div').remove();