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.
$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,

View File

@ -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();
}

View File

@ -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));