Skip to content

Commit

Permalink
Add test for cancellation of insert-event
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanvda committed Oct 24, 2021
1 parent 424e4a7 commit 1a45d69
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/assets/javascripts/projects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(document).ready(function() {
$(document).on("page:load turbolinks:load", function() {
$("#owner a.add_fields").
data("association-insertion-position", 'before').
data("association-insertion-node", 'this');
Expand Down Expand Up @@ -45,7 +45,13 @@ $(document).ready(function() {

$('#tasks').bind('cocoon:before-insert', function(e,task_to_be_added) {
console.log(task_to_be_added);
task_to_be_added.fadeIn('slow');
var confirmation = confirm("Are you sure?");

if( confirmation === false ) {
e.preventDefault();
}

task_to_be_added.fadeIn('slow')
});

$('#tasks').bind('cocoon:after-insert', function(e, added_task) {
Expand All @@ -58,4 +64,4 @@ $(document).ready(function() {
})

//$('body').tabs();
});
});

0 comments on commit 1a45d69

Please sign in to comment.