Skip to content

Instantly share code, notes, and snippets.

@andreisebastianc
Created February 20, 2014 08:24
Show Gist options
  • Save andreisebastianc/9109104 to your computer and use it in GitHub Desktop.
Save andreisebastianc/9109104 to your computer and use it in GitHub Desktop.
notes for modals
AbstractModalDialog += {
initialize: function () {
this.resolution: new Deferred();
}
accept: function () {
throw new Error('implement me');
},
reject: function () {
throw new Error('implement me');
}
}
// sters: handleAck, handleCancel, bindEvents
ConfirmationDialog = AbstractModalDialog.extend({
});
// dialog genereaza dialog de notificare
Dialog1 = {
accept: function () {
if ( this.valid() ) {
this.resolution.resolve();
} else {
new Modal()
}
}
}
// in modal
Dialog1.resolution.always(this.close.bind(this);
// dialog genereaza dialog de notificare si ar trebui sa se inchida sincron
Dialog2 = {
accept: function () {
var that;
if ( this.valid() ) {
this.resolution.resolve();
} else {
that = this;
new Modal().done( function (result) {
if ( v1 ) {
// do something with result here
if ( result && this.valid() ) {
this.resolution.resolve()
}
}
if ( v2 ) {
this.resolution.resolve(that.something)
}
});
}
}
}
// in modal
Dialog2.resolution.always(this.close.bind(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment