mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
BootstrapDialog.Request implementation
This commit is contained in:
parent
094d08df4d
commit
2459a14c9b
@ -53,6 +53,7 @@
|
|||||||
<include>${basedir}/target/tmp/Utils-min.js</include>
|
<include>${basedir}/target/tmp/Utils-min.js</include>
|
||||||
<include>${basedir}/../mindplot/src/main/javascript/Options.js</include>
|
<include>${basedir}/../mindplot/src/main/javascript/Options.js</include>
|
||||||
<include>${basedir}/../mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js</include>
|
<include>${basedir}/../mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js</include>
|
||||||
|
<include>${basedir}/../mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.Request.js</include>
|
||||||
</includes>
|
</includes>
|
||||||
</aggregation>
|
</aggregation>
|
||||||
</aggregations>
|
</aggregations>
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
BootstrapDialog.Request = new Class({
|
||||||
|
|
||||||
|
Extends: BootstrapDialog,
|
||||||
|
|
||||||
|
initialize: function(url, requestOptions, options) {
|
||||||
|
//this.parent(options);
|
||||||
|
this.requestOptions = requestOptions || {};
|
||||||
|
this.requestOptions.cache = false;
|
||||||
|
var me = this;
|
||||||
|
this.requestOptions.fail = function(xhr) {
|
||||||
|
// Intercept form requests ...
|
||||||
|
console.log("Failure:");
|
||||||
|
console.log(xhr);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.requestOptions.success = function() {
|
||||||
|
// Intercept form requests ...
|
||||||
|
var forms = me._native.find('form');
|
||||||
|
_.each(forms, function(form) {
|
||||||
|
$(form).on('submit', function(event) {
|
||||||
|
// Intercept form ...
|
||||||
|
me.requestOptions.url = form.action;
|
||||||
|
me.requestOptions.method = form.method ? form.method : 'post';
|
||||||
|
$.ajax(me.requestOptions);
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var request = $('<div></div>');
|
||||||
|
request.load(url, function() {
|
||||||
|
me._native = $(this).find('.modal');
|
||||||
|
if (!me._native) {
|
||||||
|
throw new Error('modal not found');
|
||||||
|
} else {
|
||||||
|
$(document.body).append(me._native);
|
||||||
|
me.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this._native.on('hidden.bs.modal', function () {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
@ -130,4 +130,5 @@ div#headerActions a:hover, div#headerActions a:active, div#headerActions a:link,
|
|||||||
#dialogMainForm label
|
#dialogMainForm label
|
||||||
{
|
{
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user