mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 20:03:48 +01:00
fix error in pom and add data for accept click events in bootstrap dialogs
This commit is contained in:
parent
513781272e
commit
91f85139ca
@ -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 = $('<div class="modal fade" tabindex="-1"></div>').append('<div class="modal-dialog"></div>');
|
||||
var content = $('<div class="modal-content"></div>');
|
||||
content.on('keydown', function(event) {
|
||||
@ -48,12 +48,12 @@ var BootstrapDialog = new Class({
|
||||
if (this.options.acceptButton) {
|
||||
this.acceptButton = $('<button type="button" class="btn btn-primary" id="acceptBtn" data-dismiss="modal">'+ $msg('ACCEPT') + '</button>');
|
||||
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 = $('<button type="button" class="btn btn-secondary" id="removeBtn" data-dismiss="modal">'+ $msg('REMOVE') +'</button>');
|
||||
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('<button type="button" class="btn btn-secondary" data-dismiss="modal">'+ $msg('CANCEL') +'</button>');
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user