Skip to content

Commit 61fdd9a

Browse files
authored
Merge pull request #6540 from avalonmediasystem/develop
Avalon 8.1 RC3
2 parents 2734bcc + 70ea5f1 commit 61fdd9a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

app/assets/javascripts/button_confirmation.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@ window.apply_button_confirmation = function () {
4242
}
4343
});
4444
});
45+
};
4546

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+
});
5758

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();
6563
}
66-
};
64+
bootstrap.Popover.getInstance(e.target).show();
65+
return false;
66+
});
6767
// END: 'apply_button_confirmation' coffeescript to javascript conversion
6868

6969
// After showing the popover, focus the first button inside it for keyboard accessibility

0 commit comments

Comments
 (0)