fix error in pom and add data for accept click events in bootstrap dialogs

This commit is contained in:
Ezequiel Bergamaschi 2014-12-26 23:13:12 -03:00
parent 513781272e
commit 91f85139ca
4 changed files with 18 additions and 20 deletions

View File

@ -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>');

View File

@ -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);

View File

@ -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() {

View File

@ -98,6 +98,8 @@
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>