From f3904c5e850444555e6610e68dec86bd3009e259 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 14 Oct 2020 12:26:15 +0200 Subject: [PATCH] Close Exercise Collection modal and clear input --- app/assets/javascripts/exercise_collections.js.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/exercise_collections.js.erb b/app/assets/javascripts/exercise_collections.js.erb index e44515d9..ff8dee9f 100644 --- a/app/assets/javascripts/exercise_collections.js.erb +++ b/app/assets/javascripts/exercise_collections.js.erb @@ -183,11 +183,13 @@ $(document).on('turbolinks:load', function() { addExercisesButton.on('click', function (e) { e.preventDefault(); - var selectedExercises = addExercisesForm.find('select')[0].selectedOptions; + const selectedExercises = addExercisesForm.find('select')[0].selectedOptions; for (var i = 0; i < selectedExercises.length; i++) { addExercise(selectedExercises[i].value, selectedExercises[i].label); } + $('#add-exercise-modal').modal('hide') updateExerciseList(); + addExercisesForm.find('select').val('').trigger("chosen:updated"); }); removeExerciseButtons.on('click', function (e) {