BootstrapDialog and fixing LinkEditor
This commit is contained in:
@@ -1,31 +1,70 @@
|
||||
var BootstrapDialog = new Class({
|
||||
Implements: Options,
|
||||
|
||||
initialize: function () {
|
||||
this._native = $('<div></div>');
|
||||
options: {
|
||||
cancelButton: false,
|
||||
closeButton: false,
|
||||
acceptButton: true
|
||||
},
|
||||
|
||||
initialize: function (title, options) {
|
||||
this.setOptions(options);
|
||||
this._native = $('<div class="modal fade"></div>').append('<div class="modal-dialog"></div>');
|
||||
var content = $('<div class="modal-content"></div>');
|
||||
var header = this._buildHeader(title);
|
||||
if (header) {
|
||||
content.append(header);
|
||||
}
|
||||
content.append('<div class="modal-body"></div>');
|
||||
var footer = this._buildFooter();
|
||||
if (footer) {
|
||||
content.append(footer);
|
||||
}
|
||||
|
||||
show: function (title) {
|
||||
$assert(title, "message can not be null");
|
||||
|
||||
var modalDialog = $(
|
||||
'<div class="modal fade">' +
|
||||
'<div class="modal-dialog">' +
|
||||
'<div class="modal-content">' +
|
||||
'<div class="modal-header">' +
|
||||
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>' +
|
||||
'<h3 class="modal-title">' + title + '</h3>' +
|
||||
'</div>' +
|
||||
'<div class="modal-body">' +
|
||||
this._native.html() +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
modalDialog.modal();
|
||||
},
|
||||
|
||||
setContent:function (content){
|
||||
this._native.append(content);
|
||||
},
|
||||
|
||||
_buildFooter: function() {
|
||||
var footer = null;
|
||||
if (this.options.acceptButton || this.options.cancelButton) {
|
||||
footer = $('<div class="modal-footer">');
|
||||
}
|
||||
if (this.options.acceptButton) {
|
||||
footer.append('<button type="button" class="btn btn-primary">'+ $msg('ACCEPT') +'</button>')
|
||||
}
|
||||
if (this.options.cancelButton) {
|
||||
footer.append('<button type="button" class="btn btn-default" data-dismiss="modal">'+ $msg('CANCEL') +'</button>');
|
||||
}
|
||||
return footer;
|
||||
},
|
||||
|
||||
_buildHeader: function(title) {
|
||||
var header = null;
|
||||
if (this.options.closeButton || title) {
|
||||
header = $('<div class="modal-header"></div>');
|
||||
}
|
||||
if (this.options.closeButton) {
|
||||
header.append(
|
||||
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'
|
||||
);
|
||||
}
|
||||
if (title) {
|
||||
header.append('<h3 class="modal-title">' + title + '</h3>');
|
||||
}
|
||||
return header;
|
||||
},
|
||||
|
||||
|
||||
show: function () {
|
||||
this._native.modal();
|
||||
},
|
||||
|
||||
setContent: function(content) {
|
||||
// faltaria remover body previo
|
||||
this._native.find('.modal-body').append(content);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
this._native.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user