diff --git a/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js b/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js index b42750f7..62ecc3de 100644 --- a/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js +++ b/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js @@ -7,12 +7,12 @@ var BootstrapDialog = new Class({ acceptButton: true, removeButton:false, errorMessage: false, - onRemoveClickData:{} + onEventData:{} }, initialize: function (title, options) { this.setOptions(options); - this.options.onRemoveClickData.dialog = this; + this.options.onEventData.dialog = this; this._native = $('
').append(''); var content = $(''); content.on('keydown', function(event) { @@ -48,12 +48,12 @@ var BootstrapDialog = new Class({ if (this.options.acceptButton) { this.acceptButton = $(''); footer.append(this.acceptButton); - this.acceptButton.unbind('click').click(this.onAcceptClick) + this.acceptButton.unbind('click').on("click",this.options.onEventData, this.onAcceptClick) } if (this.options.removeButton) { this.removeButton = $(''); footer.append(this.removeButton); - this.removeButton.on('click', this.options.onRemoveClickData, this.onRemoveClick); + this.removeButton.on('click', this.options.onEventData, this.onRemoveClick); } if (this.options.cancelButton) { footer.append(''); diff --git a/mindplot/src/main/javascript/widget/LinkEditor.js b/mindplot/src/main/javascript/widget/LinkEditor.js index 0bab8bfb..9443edba 100644 --- a/mindplot/src/main/javascript/widget/LinkEditor.js +++ b/mindplot/src/main/javascript/widget/LinkEditor.js @@ -28,7 +28,7 @@ mindplot.widget.LinkEditor = new Class({ acceptButton: true, removeButton: typeof model.getValue() != 'undefined', errorMessage: true, - onRemoveClickData: {model: this._model} + onEventData: {model: this._model} }); this.css({margin:"150px auto"}); var panel = this._buildPanel(model); diff --git a/mindplot/src/main/javascript/widget/NoteEditor.js b/mindplot/src/main/javascript/widget/NoteEditor.js index a0cac2b8..f19ac237 100644 --- a/mindplot/src/main/javascript/widget/NoteEditor.js +++ b/mindplot/src/main/javascript/widget/NoteEditor.js @@ -27,7 +27,7 @@ mindplot.widget.NoteEditor = new Class({ closeButton: true, acceptButton: true, removeButton: typeof model.getValue() != 'undefined', - onRemoveClickData: {model: this._model} + onEventData: {model: this._model} }); this.css({margin:"150px auto"}); var panel = this._buildPanel(model); @@ -60,24 +60,20 @@ mindplot.widget.NoteEditor = new Class({ textArea.val(model.getValue()); } - var me = this; - $(document).ready(function () { - $(document).on('submit','#noteFormId',function (event) { - event.stopPropagation(); - event.preventDefault(); - if (textArea.val()) { - model.setValue(textArea.val()); - } - me.close(); - }); - }); - result.append(form); return result; }, - onAcceptClick: function() { - $("#noteFormId").submit(); + onAcceptClick: function(event) { + event.data.dialog._submitForm(event.data.model); + }, + + _submitForm: function(model) { + var textarea = this._native.find("textarea"); + if (textarea.val()) { + model.setValue(textarea.val()); + } + this.close(); }, onDialogShown: function() { diff --git a/pom.xml b/pom.xml index bd852f7e..60b38e5c 100644 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,8 @@