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