From 49d072934b0aff76e228be04f0c4d24686c76820 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 28 Dec 2011 17:58:33 -0500 Subject: [PATCH] Clean up the names of methods for createDom from the post-closure rewrite --- web_frontend/actor.js | 19 ++++++++----------- web_frontend/path_control.js | 13 +++++++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/web_frontend/actor.js b/web_frontend/actor.js index 9965625..e9c10c0 100644 --- a/web_frontend/actor.js +++ b/web_frontend/actor.js @@ -65,27 +65,24 @@ armadillo.Actor.optionStrings_ = { 'download' : 'Download' }; -armadillo.Actor.prototype.createDom = function() { - this.decorateInternal($.createDom('div')); - return this.element_; -}; - /** - * Decorates the given element into a path control. - * @param {Element} element + * Creates and sets the elemnt this object represents. + * @return {Element} */ -armadillo.Actor.prototype.decorateInternal = function(element) { - this.element_ = element; - this.element_.addClass('actor'); - this.element_.empty(); +armadillo.Actor.prototype.createDom = function() { + this.element_ = $.createDom('div').addClass('actor').empty(); for (var option in armadillo.Actor.options_) { var tile = this.createTile_(option); if (tile) { this.element_.append(tile); } } + + this.controlContainer_ = $.createDom('div'); this.element_.append(this.controlContainer_); + + return this.element_; }; /** diff --git a/web_frontend/path_control.js b/web_frontend/path_control.js index 14bf946..57659a1 100644 --- a/web_frontend/path_control.js +++ b/web_frontend/path_control.js @@ -70,9 +70,11 @@ armadillo.PathControl.prototype.getNameControl = function() { /** * Creates a new path control object. + * @returns {Element} */ armadillo.PathControl.prototype.createDom = function() { - this.decorateInternal($.createDom('div')); + this.element_ = $.createDom('div'); + this.createDom_(this.element_); return this.element_; }; @@ -80,8 +82,7 @@ armadillo.PathControl.prototype.createDom = function() { * Decorates the given element into a path control. * @param {Element} element */ -armadillo.PathControl.prototype.decorateInternal = function(element) { - this.element_ = element; +armadillo.PathControl.prototype.createDom_ = function(element) { var components = this.path_.split('/'); // If this is an item that lives at the root, generate a special node for @@ -96,7 +97,7 @@ armadillo.PathControl.prototype.decorateInternal = function(element) { var path = ''; $.each(components, function (i, part) { - this.element_.append(this.createComponentNode_(path, part)); + element.append(this.createComponentNode_(path, part)); path = app.joinPath(path, part); }.bind(this)); @@ -113,7 +114,7 @@ armadillo.PathControl.prototype.decorateInternal = function(element) { this.nameControl_ = $.createDom('span').text(this.name_); } - this.element_.append(this.nameControl_); + element.append(this.nameControl_); }; /** @@ -185,7 +186,7 @@ armadillo.PathControl.prototype.fetchMenuContents_ = function(path, name, menu) armadillo.PathControl.prototype.componentChanged_ = function(e) { this.path_ = $(e.target).val(); this.element_.empty(); - this.decorateInternal(this.element_); + this.createDom_(this.element_); }; /** -- 2.22.5