Issue #2134929 by Wim Leers: Clean up Edit: rename EntityView to EntityDecorationView.

8.0.x
webchick 2013-11-22 19:13:41 -08:00
parent cb361bc95f
commit afa2377dca
3 changed files with 12 additions and 9 deletions

View File

@ -84,7 +84,7 @@ function edit_library_info() {
// Views. // Views.
$path . '/js/views/AppView.js' => $options, $path . '/js/views/AppView.js' => $options,
$path . '/js/views/EditorDecorationView.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/EntityToolbarView.js' => $options,
$path . '/js/views/ContextualLinkView.js' => $options, $path . '/js/views/ContextualLinkView.js' => $options,
$path . '/js/views/FieldToolbarView.js' => $options, $path . '/js/views/FieldToolbarView.js' => $options,

View File

@ -363,8 +363,8 @@ function initializeEntityContextualLink (contextualLink) {
return false; return false;
} }
// The entity for the given contextual link contains at least one field that // The entity for the given contextual link contains at least one field that
// the current user may edit in-place; instantiate EntityModel, EntityView and // the current user may edit in-place; instantiate EntityModel,
// ContextualLinkView. // EntityDecorationView and ContextualLinkView.
else if (hasFieldWithPermission(fieldIDs)) { else if (hasFieldWithPermission(fieldIDs)) {
var entityModel = new Drupal.edit.EntityModel({ var entityModel = new Drupal.edit.EntityModel({
el: contextualLink.region, el: contextualLink.region,
@ -372,12 +372,13 @@ function initializeEntityContextualLink (contextualLink) {
label: Drupal.edit.metadata.get(contextualLink.entityID, 'label') label: Drupal.edit.metadata.get(contextualLink.entityID, 'label')
}); });
Drupal.edit.collections.entities.add(entityModel); Drupal.edit.collections.entities.add(entityModel);
// Create an EntityView associated with the root DOM node of the entity. // Create an EntityDecorationView associated with the root DOM node of the
var entityView = new Drupal.edit.EntityView({ // entity.
var entityDecorationView = new Drupal.edit.EntityDecorationView({
el: contextualLink.region, el: contextualLink.region,
model: entityModel model: entityModel
}); });
entityModel.set('entityView', entityView); entityModel.set('entityDecorationView', entityDecorationView);
// Initialize all queued fields within this entity (creates FieldModels). // Initialize all queued fields within this entity (creates FieldModels).
_.each(fields, function (field) { _.each(fields, function (field) {
@ -437,8 +438,8 @@ function deleteContainedModelsAndQueues($context) {
var contextualLinkView = entityModels[0].get('contextualLinkView'); var contextualLinkView = entityModels[0].get('contextualLinkView');
contextualLinkView.undelegateEvents(); contextualLinkView.undelegateEvents();
contextualLinkView.remove(); contextualLinkView.remove();
// Remove the EntityView. // Remove the EntityDecorationView.
entityModels[0].get('entityView').remove(); entityModels[0].get('entityDecorationView').remove();
// Destroy the EntityModel; this will also destroy its FieldModels. // Destroy the EntityModel; this will also destroy its FieldModels.
entityModels[0].destroy(); entityModels[0].destroy();
} }

View File

@ -2,7 +2,8 @@
"use strict"; "use strict";
Drupal.edit.EntityView = Backbone.View.extend({ Drupal.edit.EntityDecorationView = Backbone.View.extend({
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
@ -26,6 +27,7 @@ Drupal.edit.EntityView = Backbone.View.extend({
this.setElement(null); this.setElement(null);
Backbone.View.prototype.remove.call(this); Backbone.View.prototype.remove.call(this);
} }
}); });
}(jQuery, Backbone)); }(jQuery, Backbone));