X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0ac983162763199b07270a9a675e22672d4462ce..4f9f0e6fbf1be3805f9995c536a583eda1260bee:/project/static/js/views/view.js diff --git a/project/static/js/views/view.js b/project/static/js/views/view.js index 59b339f7..bc8266c1 100644 --- a/project/static/js/views/view.js +++ b/project/static/js/views/view.js @@ -1,28 +1,29 @@ /*globals Editor render_template*/ var View = Editor.Object.extend({ + _className: 'View', element: null, model: null, template: null, overlayClass: 'view-overlay', overlay: null, - id: 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(); - View.lastId = View.lastId + 1; - this.id = 'view-' + View.lastId; + this._resizeHandler = this.resized.bind(this); + $(window).bind('resize', this._resizeHandler); + $(this.element).bind('resize', this._resizeHandler); }, - - // IdentycznoÅÄ - hash: function() { - + + render: function() { + console.log('rendering:', this._className); + this.element.html(render_template(this.template, this)); }, frozen: function() { @@ -30,6 +31,9 @@ var View = Editor.Object.extend({ }, freeze: function(message) { + if (this.frozen()) { + this.unfreeze(); + } this.overlay = this.overlay || $('