Always unbind internal listeners when closing a modal dialog
This commit is contained in:
@@ -18,6 +18,7 @@ Bug fixes:
|
|||||||
|
|
||||||
* Fix wrong datetime formatting when task form shows validation errors
|
* Fix wrong datetime formatting when task form shows validation errors
|
||||||
* Empty arrays are serialized to a list instead of a dict (Json API)
|
* 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)
|
Version 1.0.37 (Jan 14, 2017)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|||||||
6
assets/js/app.min.js
vendored
6
assets/js/app.min.js
vendored
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');
|
var sectionElement = KB.dom(e.target).parent('.accordion-section');
|
||||||
|
|
||||||
if (sectionElement) {
|
if (sectionElement) {
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ KB.component('confirm-buttons', function (containerElement, options) {
|
|||||||
|
|
||||||
this.render = function () {
|
this.render = function () {
|
||||||
KB.on('modal.stop', onStop);
|
KB.on('modal.stop', onStop);
|
||||||
|
KB.on('modal.close', function () {
|
||||||
|
KB.removeListener('modal.stop', onStop);
|
||||||
|
});
|
||||||
|
|
||||||
var element = KB.dom('div')
|
var element = KB.dom('div')
|
||||||
.attr('class', 'form-actions')
|
.attr('class', 'form-actions')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ KB.component('file-upload', function (containerElement, options) {
|
|||||||
var inputFileElement = null;
|
var inputFileElement = null;
|
||||||
var dropzoneElement = null;
|
var dropzoneElement = null;
|
||||||
var files = [];
|
var files = [];
|
||||||
var currentFileIndex = null;
|
var currentFileIndex = 0;
|
||||||
|
|
||||||
function onProgress(e) {
|
function onProgress(e) {
|
||||||
if (e.lengthComputable) {
|
if (e.lengthComputable) {
|
||||||
@@ -183,6 +183,9 @@ KB.component('file-upload', function (containerElement, options) {
|
|||||||
|
|
||||||
this.render = function () {
|
this.render = function () {
|
||||||
KB.on('modal.submit', onSubmit);
|
KB.on('modal.submit', onSubmit);
|
||||||
|
KB.on('modal.close', function () {
|
||||||
|
KB.removeListener('modal.submit', onSubmit);
|
||||||
|
});
|
||||||
|
|
||||||
inputFileElement = buildFileInputElement();
|
inputFileElement = buildFileInputElement();
|
||||||
dropzoneElement = buildDropzoneElement();
|
dropzoneElement = buildDropzoneElement();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ KB.component('screenshot', function (containerElement) {
|
|||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
// Find an image in pasted elements
|
// Find an image in pasted elements
|
||||||
if (items[i].type.indexOf("image") !== -1) {
|
if (items[i].type.indexOf("image") !== -1) {
|
||||||
|
|
||||||
var blob = items[i].getAsFile();
|
var blob = items[i].getAsFile();
|
||||||
|
|
||||||
// Get the image as base64 data
|
// 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.start', onLoadingStart);
|
||||||
KB.on('select.dropdown.loading.stop', onLoadingStop);
|
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')
|
chevronIconElement = KB.dom('i')
|
||||||
.attr('class', 'fa fa-chevron-down select-dropdown-chevron')
|
.attr('class', 'fa fa-chevron-down select-dropdown-chevron')
|
||||||
.click(toggleDropdownMenu)
|
.click(toggleDropdownMenu)
|
||||||
|
|||||||
@@ -78,6 +78,14 @@ KB.component('submit-buttons', function (containerElement, options) {
|
|||||||
KB.on('modal.hide', onHide);
|
KB.on('modal.hide', onHide);
|
||||||
KB.on('modal.submit.label', onUpdateSubmitLabel);
|
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')
|
var formActionElementBuilder = KB.dom('div')
|
||||||
.attr('class', 'form-actions')
|
.attr('class', 'form-actions')
|
||||||
.add(buildButton());
|
.add(buildButton());
|
||||||
|
|||||||
@@ -146,6 +146,9 @@ KB.component('task-move-position', function (containerElement, options) {
|
|||||||
|
|
||||||
this.render = function () {
|
this.render = function () {
|
||||||
KB.on('modal.submit', onSubmit);
|
KB.on('modal.submit', onSubmit);
|
||||||
|
KB.on('modal.close', function () {
|
||||||
|
KB.removeListener('modal.submit', onSubmit);
|
||||||
|
});
|
||||||
|
|
||||||
var form = KB.dom('div')
|
var form = KB.dom('div')
|
||||||
.add(KB.dom('div').attr('id', 'message-container').build())
|
.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) {
|
KB.onClick = function (selector, callback) {
|
||||||
this.listeners.clicks[selector] = callback;
|
this.listeners.clicks[selector] = callback;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user