EntityDecorationView.js 825 B

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