Issue #2134929 by Wim Leers: Clean up Edit: rename EntityView to EntityDecorationView.
parent
cb361bc95f
commit
afa2377dca
|
@ -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,
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
Loading…
Reference in New Issue