overlayClass: 'view-overlay',
overlay: null,
- init: function(element, model, template) {
+ init: function(element, model, template)
+ {
+ console.log("init for view");
this.element = $(element);
this.model = model;
this.template = template || this.template;
- if (this.template) {
- this.element.html(render_template(this.template, this));
- }
+ if (this.template) this.render();
this._resizeHandler = this.resized.bind(this);
$(window).bind('resize', this._resizeHandler);
$(this.element).bind('resize', this._resizeHandler);
},
+
+ render: function() {
+ console.log('rendering:', this._className);
+ this.element.html(render_template(this.template, this));
+ },
frozen: function() {
return !!this.overlay;
},
freeze: function(message) {
+ if (this.frozen()) {
+ this.unfreeze();
+ }
this.overlay = this.overlay
|| $('<div><div>' + message + '</div></div>')
.addClass(this.overlayClass)
},
resized: function(event) {
- console.log('resized', this.description(), this.element);
if (this.frozen()) {
- console.log('css!');
this.overlay.css({
position: 'absolute',
width: this.element.width(),
height: this.element.height(),
top: this.element.position().top,
left: this.element.position().left
+ }).children('div').css({
+ position: 'relative',
+ top: this.overlay.height() / 2 - 20
});
}
},