X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3193141f55df20910cf8ba35f9e669d79c90d3f4..514e98aeae05045d0086aae39960124a572e646f:/platforma/static/js/views/view.js diff --git a/platforma/static/js/views/view.js b/platforma/static/js/views/view.js deleted file mode 100644 index d0c6d170..00000000 --- a/platforma/static/js/views/view.js +++ /dev/null @@ -1,82 +0,0 @@ -/*globals Editor render_template*/ -var View = Editor.Object.extend({ - _className: 'View', - element: null, - model: null, - template: null, - overlayClass: 'view-overlay', - overlay: null, - - 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.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 || $('
' + message + '
'); - - this.overlay.addClass(this.overlayClass) - .css({ - - }).attr('unselectable', 'on') - - this.overlay.appendTo(this.element); - - var ovc = this.overlay.children('div'); - var padV = (this.overlay.height() - ovc.outerHeight())/2; - var padH = (this.overlay.width() - ovc.outerWidth())/2; - - this.overlay.children('div').css({ - top: padV, left: padH - }); - }, - - unfreeze: function() { - if (this.frozen()) { - this.overlay.remove(); - this.overlay = null; - } - }, - - resized: function(event) { - if(this.overlay) { - var ovc = this.overlay.children('div'); - var padV = (this.overlay.height() - ovc.outerHeight())/2; - var padH = (this.overlay.width() - ovc.outerWidth())/2; - - this.overlay.children('div').css({ - top: padV, - left: padH - }); - } - }, - - dispose: function() { - console.log('disposing:', this._className); - $(window).unbind('resize', this._resizeHandler); - $(this.element).unbind('resize', this._resizeHandler); - this.unfreeze(); - this.element.html(''); - } -}); \ No newline at end of file