diff --git a/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js b/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js index d1962f25..691091d4 100644 --- a/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js +++ b/mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js @@ -5,11 +5,13 @@ var BootstrapDialog = new Class({ cancelButton: false, closeButton: false, acceptButton: true, - removeButton:false + removeButton:false, + onRemoveClickData:{} }, initialize: function (title, options) { this.setOptions(options); + this.options.onRemoveClickData.dialog = this; this._native = $('').append(''); var content = $(''); var header = this._buildHeader(title); @@ -38,7 +40,7 @@ var BootstrapDialog = new Class({ if (this.options.removeButton) { this.removeButton = $(''); footer.append(this.removeButton); - this.removeButton.on('click', {data:'hola'}, this.onRemoveClick); + this.removeButton.on('click', this.options.onRemoveClickData, this.onRemoveClick); this.removeButton.hide(); } if (this.options.cancelButton) { @@ -58,7 +60,7 @@ var BootstrapDialog = new Class({ ); } if (title) { - header.append(''); + header.append(''); } return header; }, @@ -69,7 +71,8 @@ var BootstrapDialog = new Class({ onRemoveClick: function(event) { - //this method should be abstract + event.data.model.setValue(null); + event.data.dialog.close(); }, show: function () { @@ -81,8 +84,8 @@ var BootstrapDialog = new Class({ this._native.find('.modal-body').append(content); }, - setStyle:function(width){ - this._native.find('.modal-dialog').css("width",width); + css:function(options){ + this._native.find('.modal-dialog').css(options); }, close: function() {