1 /*globals Class render_template*/
2 var View = Class.extend({
6 overlayClass: 'view-overlay',
9 init: function(element, model, template) {
10 this.element = $(element);
12 this.template = template || this.template;
15 this.element.html(render_template(this.template, {}));
20 return !!this.overlay;
23 freeze: function(message) {
24 this.overlay = this.overlay
25 || $('<div><div>' + message + '</div></div>')
26 .addClass(this.overlayClass)
29 width: this.element.width(),
30 height: this.element.height(),
31 top: this.element.position().top,
32 left: this.element.position().left
34 .appendTo(this.element.parent());
36 this.overlay.children('div').css({
38 top: this.overlay.height() / 2 - 20
42 unfreeze: function() {
44 this.overlay.remove();
51 this.element.contents().remove();