1 /*globals Editor render_template*/
2 var View = Editor.Object.extend({
6 overlayClass: 'view-overlay',
10 init: function(element, model, template) {
11 this.element = $(element);
13 this.template = template || this.template;
16 this.element.html(render_template(this.template, this));
19 View.lastId = View.lastId + 1;
20 this.id = 'view-' + View.lastId;
29 return !!this.overlay;
32 freeze: function(message) {
33 this.overlay = this.overlay
34 || $('<div><div>' + message + '</div></div>')
35 .addClass(this.overlayClass)
38 width: this.element.width(),
39 height: this.element.height(),
40 top: this.element.position().top,
41 left: this.element.position().left
43 .appendTo(this.element.parent());
45 this.overlay.children('div').css({
47 top: this.overlay.height() / 2 - 20
51 unfreeze: function() {
53 this.overlay.remove();
60 this.element.contents().remove();