dialog-js.mustache revision c2e84dfa3d5903f5bf0f10a70508b3effc3d26ee
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe var dialog = new Y.Panel({
ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2abYuri Pankov bodyContent: '<div class="message icon-warn">Are you sure you want to [take some action]?</div>',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe width : 410,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe zIndex : 6,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe centered : true,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// modal : true, // uncomment for modal behavior
ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2abYuri Pankov srcNode : '#dialog',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe render : true,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe buttons: [
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe value : 'Cancel',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe section: Y.WidgetStdMod.FOOTER,
ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2abYuri Pankov action : function (e) {
ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2abYuri Pankov e.preventDefault();
ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2abYuri Pankov dialog.hide();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // the callback is not executed, and is
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // callback reference removed, so it won't persist
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe this.callback = false;
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe }
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe value : 'OK',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe section: Y.WidgetStdMod.FOOTER,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe action : function (e) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe e.preventDefault();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe dialog.hide();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // code that executes the user confirmed action goes here
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe if(this.callback){
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe this.callback();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe }
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // callback reference removed, so it won't persist
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe this.callback = false;
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe }
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe }
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe });
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe