summaryrefslogtreecommitdiff
path: root/assets/js/components
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-26 22:21:07 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-26 22:21:07 -0500
commita371d53e635f1c0aa6097045ac5b59e78962f760 (patch)
tree710921d7d7e82450bc0f01158353de24aa7f6fd2 /assets/js/components
parentc3d42a21b28805ab0ec3d7bac3530972ca356067 (diff)
Always unbind internal listeners when closing a modal dialog
Diffstat (limited to 'assets/js/components')
-rw-r--r--assets/js/components/accordion.js2
-rw-r--r--assets/js/components/confirm-buttons.js3
-rw-r--r--assets/js/components/file-upload.js5
-rw-r--r--assets/js/components/screenshot.js1
-rw-r--r--assets/js/components/select-dropdown-autocomplete.js5
-rw-r--r--assets/js/components/submit-buttons.js8
-rw-r--r--assets/js/components/task-move-position.js3
7 files changed, 24 insertions, 3 deletions
diff --git a/assets/js/components/accordion.js b/assets/js/components/accordion.js
index f64768b6..2f617fb5 100644
--- a/assets/js/components/accordion.js
+++ b/assets/js/components/accordion.js
@@ -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) {
diff --git a/assets/js/components/confirm-buttons.js b/assets/js/components/confirm-buttons.js
index d8b1e752..da31df55 100644
--- a/assets/js/components/confirm-buttons.js
+++ b/assets/js/components/confirm-buttons.js
@@ -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')
diff --git a/assets/js/components/file-upload.js b/assets/js/components/file-upload.js
index 762eb6e1..f4445a44 100644
--- a/assets/js/components/file-upload.js
+++ b/assets/js/components/file-upload.js
@@ -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();
diff --git a/assets/js/components/screenshot.js b/assets/js/components/screenshot.js
index 069b3396..a8acd64e 100644
--- a/assets/js/components/screenshot.js
+++ b/assets/js/components/screenshot.js
@@ -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
diff --git a/assets/js/components/select-dropdown-autocomplete.js b/assets/js/components/select-dropdown-autocomplete.js
index 42344be5..c2c36f5b 100644
--- a/assets/js/components/select-dropdown-autocomplete.js
+++ b/assets/js/components/select-dropdown-autocomplete.js
@@ -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)
diff --git a/assets/js/components/submit-buttons.js b/assets/js/components/submit-buttons.js
index 24d46855..2745841a 100644
--- a/assets/js/components/submit-buttons.js
+++ b/assets/js/components/submit-buttons.js
@@ -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());
diff --git a/assets/js/components/task-move-position.js b/assets/js/components/task-move-position.js
index a1cd969e..e5a68b94 100644
--- a/assets/js/components/task-move-position.js
+++ b/assets/js/components/task-move-position.js
@@ -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())