Created
February 20, 2014 08:24
-
-
Save andreisebastianc/9109104 to your computer and use it in GitHub Desktop.
notes for modals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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