From afa2377dcad05ae38a82f9809ecd94bc686ccac1 Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 22 Nov 2013 19:13:41 -0800 Subject: [PATCH] Issue #2134929 by Wim Leers: Clean up Edit: rename EntityView to EntityDecorationView. --- core/modules/edit/edit.module | 2 +- core/modules/edit/js/edit.js | 15 ++++++++------- .../{EntityView.js => EntityDecorationView.js} | 4 +++- 3 files changed, 12 insertions(+), 9 deletions(-) rename core/modules/edit/js/views/{EntityView.js => EntityDecorationView.js} (89%) diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index 9e4d13262032..6512d3517e0f 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -84,7 +84,7 @@ function edit_library_info() { // Views. $path . '/js/views/AppView.js' => $options, $path . '/js/views/EditorDecorationView.js' => $options, - $path . '/js/views/EntityView.js' => $options, + $path . '/js/views/EntityDecorationView.js' => $options, $path . '/js/views/EntityToolbarView.js' => $options, $path . '/js/views/ContextualLinkView.js' => $options, $path . '/js/views/FieldToolbarView.js' => $options, diff --git a/core/modules/edit/js/edit.js b/core/modules/edit/js/edit.js index b8afb6cbab84..0712d65cacf8 100644 --- a/core/modules/edit/js/edit.js +++ b/core/modules/edit/js/edit.js @@ -363,8 +363,8 @@ function initializeEntityContextualLink (contextualLink) { return false; } // The entity for the given contextual link contains at least one field that - // the current user may edit in-place; instantiate EntityModel, EntityView and - // ContextualLinkView. + // the current user may edit in-place; instantiate EntityModel, + // EntityDecorationView and ContextualLinkView. else if (hasFieldWithPermission(fieldIDs)) { var entityModel = new Drupal.edit.EntityModel({ el: contextualLink.region, @@ -372,12 +372,13 @@ function initializeEntityContextualLink (contextualLink) { label: Drupal.edit.metadata.get(contextualLink.entityID, 'label') }); Drupal.edit.collections.entities.add(entityModel); - // Create an EntityView associated with the root DOM node of the entity. - var entityView = new Drupal.edit.EntityView({ + // Create an EntityDecorationView associated with the root DOM node of the + // entity. + var entityDecorationView = new Drupal.edit.EntityDecorationView({ el: contextualLink.region, model: entityModel }); - entityModel.set('entityView', entityView); + entityModel.set('entityDecorationView', entityDecorationView); // Initialize all queued fields within this entity (creates FieldModels). _.each(fields, function (field) { @@ -437,8 +438,8 @@ function deleteContainedModelsAndQueues($context) { var contextualLinkView = entityModels[0].get('contextualLinkView'); contextualLinkView.undelegateEvents(); contextualLinkView.remove(); - // Remove the EntityView. - entityModels[0].get('entityView').remove(); + // Remove the EntityDecorationView. + entityModels[0].get('entityDecorationView').remove(); // Destroy the EntityModel; this will also destroy its FieldModels. entityModels[0].destroy(); } diff --git a/core/modules/edit/js/views/EntityView.js b/core/modules/edit/js/views/EntityDecorationView.js similarity index 89% rename from core/modules/edit/js/views/EntityView.js rename to core/modules/edit/js/views/EntityDecorationView.js index a2e771ae913c..79ef7d933665 100644 --- a/core/modules/edit/js/views/EntityView.js +++ b/core/modules/edit/js/views/EntityDecorationView.js @@ -2,7 +2,8 @@ "use strict"; -Drupal.edit.EntityView = Backbone.View.extend({ +Drupal.edit.EntityDecorationView = Backbone.View.extend({ + /** * {@inheritdoc} * @@ -26,6 +27,7 @@ Drupal.edit.EntityView = Backbone.View.extend({ this.setElement(null); Backbone.View.prototype.remove.call(this); } + }); }(jQuery, Backbone));