EntityDecorationView.es6.js 774 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @file
  3. * A Backbone view that decorates the in-place editable entity.
  4. */
  5. (function (Drupal, $, Backbone) {
  6. Drupal.quickedit.EntityDecorationView = Backbone.View.extend(/** @lends Drupal.quickedit.EntityDecorationView# */{
  7. /**
  8. * Associated with the DOM root node of an editable entity.
  9. *
  10. * @constructs
  11. *
  12. * @augments Backbone.View
  13. */
  14. initialize() {
  15. this.listenTo(this.model, 'change', this.render);
  16. },
  17. /**
  18. * @inheritdoc
  19. */
  20. render() {
  21. this.$el.toggleClass('quickedit-entity-active', this.model.get('isActive'));
  22. },
  23. /**
  24. * @inheritdoc
  25. */
  26. remove() {
  27. this.setElement(null);
  28. Backbone.View.prototype.remove.call(this);
  29. },
  30. });
  31. }(Drupal, jQuery, Backbone));