@@ -42,28 +42,28 @@ window.apply_button_confirmation = function () {
42
42
}
43
43
} ) ;
44
44
} ) ;
45
+ } ;
45
46
46
- if ( popoverList . length !== 0 ) {
47
- $ ( document ) . on ( 'click' , '#special_button_color' , function ( e ) {
48
- // Stop page from scrolling up on 'Cancel' click
49
- e . preventDefault ( ) ;
50
- // Restore focus to the active delete button
51
- if ( activeDeleteBtn ) {
52
- bootstrap . Popover . getInstance ( activeDeleteBtn ) . hide ( ) ;
53
- activeDeleteBtn . focus ( ) ;
54
- }
55
- return true ;
56
- } ) ;
47
+ // Initialize the cancel button within the popover
48
+ $ ( document ) . on ( 'click' , '#special_button_color' , function ( e ) {
49
+ // Stop page from scrolling up on 'Cancel' click
50
+ e . preventDefault ( ) ;
51
+ // Restore focus to the active delete button
52
+ if ( activeDeleteBtn ) {
53
+ bootstrap . Popover . getInstance ( activeDeleteBtn ) . hide ( ) ;
54
+ activeDeleteBtn . focus ( ) ;
55
+ }
56
+ return true ;
57
+ } ) ;
57
58
58
- $ ( document ) . on ( 'confirm' , '.btn-confirmation' , function ( e ) {
59
- if ( activeDeleteBtn ) {
60
- bootstrap . Popover . getInstance ( activeDeleteBtn ) . hide ( ) ;
61
- }
62
- bootstrap . Popover . getInstance ( e . target ) . show ( ) ;
63
- return false ;
64
- } ) ;
59
+ // 'confirm' is an event generated by rails
60
+ $ ( document ) . on ( 'confirm' , '.btn-confirmation' , function ( e ) {
61
+ if ( activeDeleteBtn ) {
62
+ bootstrap . Popover . getInstance ( activeDeleteBtn ) . hide ( ) ;
65
63
}
66
- } ;
64
+ bootstrap . Popover . getInstance ( e . target ) . show ( ) ;
65
+ return false ;
66
+ } ) ;
67
67
// END: 'apply_button_confirmation' coffeescript to javascript conversion
68
68
69
69
// After showing the popover, focus the first button inside it for keyboard accessibility
0 commit comments