update remove button

This commit is contained in:
Mariela Michalek 2014-04-19 16:25:28 -03:00
parent 66e769cab0
commit 86bf506c64

View File

@ -5,11 +5,13 @@ var BootstrapDialog = new Class({
cancelButton: false, cancelButton: false,
closeButton: false, closeButton: false,
acceptButton: true, acceptButton: true,
removeButton:false removeButton:false,
onRemoveClickData:{}
}, },
initialize: function (title, options) { initialize: function (title, options) {
this.setOptions(options); this.setOptions(options);
this.options.onRemoveClickData.dialog = this;
this._native = $('<div class="modal fade"></div>').append('<div class="modal-dialog" style="margin:150px auto"></div>'); this._native = $('<div class="modal fade"></div>').append('<div class="modal-dialog" style="margin:150px auto"></div>');
var content = $('<div class="modal-content"></div>'); var content = $('<div class="modal-content"></div>');
var header = this._buildHeader(title); var header = this._buildHeader(title);
@ -38,7 +40,7 @@ var BootstrapDialog = new Class({
if (this.options.removeButton) { if (this.options.removeButton) {
this.removeButton = $('<button type="button" class="btn btn-secondary" id="removeBtn" data-dismiss="modal">'+ $msg('REMOVE') +'</button>'); this.removeButton = $('<button type="button" class="btn btn-secondary" id="removeBtn" data-dismiss="modal">'+ $msg('REMOVE') +'</button>');
footer.append(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(); this.removeButton.hide();
} }
if (this.options.cancelButton) { if (this.options.cancelButton) {
@ -58,7 +60,7 @@ var BootstrapDialog = new Class({
); );
} }
if (title) { if (title) {
header.append('<h3 class="modal-title">' + title + '</h3>'); header.append('<h2 class="modal-title">' + title + '</h2>');
} }
return header; return header;
}, },
@ -69,7 +71,8 @@ var BootstrapDialog = new Class({
onRemoveClick: function(event) { onRemoveClick: function(event) {
//this method should be abstract event.data.model.setValue(null);
event.data.dialog.close();
}, },
show: function () { show: function () {
@ -81,8 +84,8 @@ var BootstrapDialog = new Class({
this._native.find('.modal-body').append(content); this._native.find('.modal-body').append(content);
}, },
setStyle:function(width){ css:function(options){
this._native.find('.modal-dialog').css("width",width); this._native.find('.modal-dialog').css(options);
}, },
close: function() { close: function() {