From b89c3b9d1cdcde01c623a22cb960ebd703735184 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 17 Nov 2010 08:54:39 -0500 Subject: [PATCH] Make delete confirmation nonmodal. Remove dependencies on goog.ui.Dialog now. --- web_frontend/actor.js | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/web_frontend/actor.js b/web_frontend/actor.js index b077f93..bccdbe6 100644 --- a/web_frontend/actor.js +++ b/web_frontend/actor.js @@ -19,7 +19,6 @@ goog.require('goog.events.EventHandler'); goog.require('goog.style'); goog.require('goog.ui.Button'); goog.require('goog.ui.Container'); -goog.require('goog.ui.Dialog'); /** * The Actor is a popup that displays the various actions that can be performed @@ -197,26 +196,16 @@ armadillo.Actor.prototype.performMove_ = function() { * @private */ armadillo.Actor.prototype.performDelete_ = function() { - this.actionObject_ = this.createActionDialog_(); - this.actionObject_.setTitle('Confirm Delete'); - - var container = this.actionObject_.getContentElement(); var content = goog.dom.createDom('span', null, 'Are you sure you want to delete:', goog.dom.createElement('br'), goog.dom.createDom('strong', null, this.file_.getName())); - goog.dom.appendChild(container, content); + this.controlContainer_.addChild(new goog.ui.Control(content), true); - var closeCallback = function(e) { - if (e.key != goog.ui.Dialog.DefaultButtonKeys.CANCEL) { - this.file_.remove(); - } + var okCallback = function(e) { + this.file_.remove(); }; - // Will be removed when the event source closes. - this.eh_.listen(this.actionObject_, goog.ui.Dialog.SELECT_EVENT, - closeCallback, false, this); - - this.actionObject_.setVisible(true); + this.createOkCancel_(goog.bind(okCallback, this), null); }; /** @@ -228,21 +217,6 @@ armadillo.Actor.prototype.performTVRename_ = function() { renamer.run(); }; -/** - * Creates a new instance of a Dialog that has some basic properties set that - * are common to performing actions. - * @private - */ -armadillo.Actor.prototype.createActionDialog_ = function() { - var confirm = new goog.ui.Dialog(); - confirm.setDisposeOnHide(true); - confirm.setEscapeToCancel(true); - confirm.setModal(true); - confirm.setDraggable(false); - confirm.setHasTitleCloseButton(false); - return confirm; -}; - /** * Creates two buttons: one for OK one for Cancel and attahes them to the * |controlContainer_|. -- 2.43.5