trigger event when dialog is shown to perform custom dialog actions
This commit is contained in:
@@ -37,6 +37,12 @@ BootstrapDialog.Request = new Class({
|
||||
});
|
||||
me.show();
|
||||
});
|
||||
},
|
||||
|
||||
onDialogShown: function() {
|
||||
if (typeof(onDialogShown) == "function") {
|
||||
onDialogShown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,6 +34,7 @@ var BootstrapDialog = new Class({
|
||||
content.append(footer);
|
||||
}
|
||||
this._native.find(".modal-dialog").append(content);
|
||||
this._native.on('shown.bs.modal', this.onDialogShown);
|
||||
},
|
||||
|
||||
_buildFooter: function() {
|
||||
@@ -78,7 +79,9 @@ var BootstrapDialog = new Class({
|
||||
//this method should be abstract
|
||||
},
|
||||
|
||||
onDialogShown: function() {
|
||||
|
||||
},
|
||||
onRemoveClick: function(event) {
|
||||
event.data.model.setValue(null);
|
||||
event.data.dialog.close();
|
||||
|
@@ -51,7 +51,7 @@ mindplot.widget.LinkEditor = new Class({
|
||||
});
|
||||
|
||||
// Add Input
|
||||
var input = $('<input/>').attr({
|
||||
var input = $('<input id="inputUrl"/>').attr({
|
||||
'placeholder': 'http://www.example.com/',
|
||||
'required': 'true',
|
||||
'autofocus': 'autofocus',
|
||||
@@ -116,6 +116,10 @@ mindplot.widget.LinkEditor = new Class({
|
||||
if (!this.formSubmitted) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
onDialogShown: function() {
|
||||
$(this).find('#inputUrl').focus();
|
||||
}
|
||||
|
||||
});
|
||||
|
@@ -44,10 +44,9 @@ mindplot.widget.NoteEditor = new Class({
|
||||
});
|
||||
|
||||
// Add textarea
|
||||
var textArea = $('<textarea></textarea>').attr({
|
||||
var textArea = $('<textarea></textarea autofocus>').attr({
|
||||
'placeholder':$msg('WRITE_YOUR_TEXT_HERE'),
|
||||
'required':'true',
|
||||
'autofocus':'autofocus',
|
||||
'class':'form-control'
|
||||
});
|
||||
textArea.css({
|
||||
@@ -82,6 +81,10 @@ mindplot.widget.NoteEditor = new Class({
|
||||
|
||||
onAcceptClick: function() {
|
||||
$("#noteFormId").submit();
|
||||
},
|
||||
|
||||
onDialogShown: function() {
|
||||
$(this).find('textarea').focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user