Always unbind internal listeners when closing a modal dialog
This commit is contained in:
parent
c3d42a21b2
commit
a371d53e63
|
|
@ -18,6 +18,7 @@ Bug fixes:
|
|||
|
||||
* Fix wrong datetime formatting when task form shows validation errors
|
||||
* Empty arrays are serialized to a list instead of a dict (Json API)
|
||||
* Always unbind internal listeners when closing a modal dialog
|
||||
|
||||
Version 1.0.37 (Jan 14, 2017)
|
||||
-----------------------------
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
KB.onClick('.accordion-toggle', function(e) {
|
||||
KB.onClick('.accordion-toggle', function (e) {
|
||||
var sectionElement = KB.dom(e.target).parent('.accordion-section');
|
||||
|
||||
if (sectionElement) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ KB.component('confirm-buttons', function (containerElement, options) {
|
|||
|
||||
this.render = function () {
|
||||
KB.on('modal.stop', onStop);
|
||||
KB.on('modal.close', function () {
|
||||
KB.removeListener('modal.stop', onStop);
|
||||
});
|
||||
|
||||
var element = KB.dom('div')
|
||||
.attr('class', 'form-actions')
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ KB.component('file-upload', function (containerElement, options) {
|
|||
var inputFileElement = null;
|
||||
var dropzoneElement = null;
|
||||
var files = [];
|
||||
var currentFileIndex = null;
|
||||
var currentFileIndex = 0;
|
||||
|
||||
function onProgress(e) {
|
||||
if (e.lengthComputable) {
|
||||
|
|
@ -183,6 +183,9 @@ KB.component('file-upload', function (containerElement, options) {
|
|||
|
||||
this.render = function () {
|
||||
KB.on('modal.submit', onSubmit);
|
||||
KB.on('modal.close', function () {
|
||||
KB.removeListener('modal.submit', onSubmit);
|
||||
});
|
||||
|
||||
inputFileElement = buildFileInputElement();
|
||||
dropzoneElement = buildDropzoneElement();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ KB.component('screenshot', function (containerElement) {
|
|||
for (var i = 0; i < items.length; i++) {
|
||||
// Find an image in pasted elements
|
||||
if (items[i].type.indexOf("image") !== -1) {
|
||||
|
||||
var blob = items[i].getAsFile();
|
||||
|
||||
// Get the image as base64 data
|
||||
|
|
|
|||
|
|
@ -238,6 +238,11 @@ KB.component('select-dropdown-autocomplete', function(containerElement, options)
|
|||
KB.on('select.dropdown.loading.start', onLoadingStart);
|
||||
KB.on('select.dropdown.loading.stop', onLoadingStop);
|
||||
|
||||
KB.on('modal.close', function () {
|
||||
KB.removeListener('select.dropdown.loading.start', onLoadingStart);
|
||||
KB.removeListener('select.dropdown.loading.stop', onLoadingStop);
|
||||
});
|
||||
|
||||
chevronIconElement = KB.dom('i')
|
||||
.attr('class', 'fa fa-chevron-down select-dropdown-chevron')
|
||||
.click(toggleDropdownMenu)
|
||||
|
|
|
|||
|
|
@ -78,6 +78,14 @@ KB.component('submit-buttons', function (containerElement, options) {
|
|||
KB.on('modal.hide', onHide);
|
||||
KB.on('modal.submit.label', onUpdateSubmitLabel);
|
||||
|
||||
KB.on('modal.close', function () {
|
||||
KB.removeListener('modal.stop', onStop);
|
||||
KB.removeListener('modal.disable', onDisable);
|
||||
KB.removeListener('modal.enable', onEnable);
|
||||
KB.removeListener('modal.hide', onHide);
|
||||
KB.removeListener('modal.submit.label', onUpdateSubmitLabel);
|
||||
});
|
||||
|
||||
var formActionElementBuilder = KB.dom('div')
|
||||
.attr('class', 'form-actions')
|
||||
.add(buildButton());
|
||||
|
|
|
|||
|
|
@ -146,6 +146,9 @@ KB.component('task-move-position', function (containerElement, options) {
|
|||
|
||||
this.render = function () {
|
||||
KB.on('modal.submit', onSubmit);
|
||||
KB.on('modal.close', function () {
|
||||
KB.removeListener('modal.submit', onSubmit);
|
||||
});
|
||||
|
||||
var form = KB.dom('div')
|
||||
.add(KB.dom('div').attr('id', 'message-container').build())
|
||||
|
|
|
|||
|
|
@ -27,6 +27,16 @@ KB.trigger = function (eventType, eventData) {
|
|||
}
|
||||
};
|
||||
|
||||
KB.removeListener = function (eventType, callback) {
|
||||
if (this.listeners.internals.hasOwnProperty(eventType)) {
|
||||
for (var i = 0; i < this.listeners.internals[eventType].length; i++) {
|
||||
if (this.listeners.internals[eventType][i] === callback) {
|
||||
this.listeners.internals[eventType].splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
KB.onClick = function (selector, callback) {
|
||||
this.listeners.clicks[selector] = callback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue