From: zuber Date: Thu, 5 Nov 2009 13:22:48 +0000 (+0100) Subject: Oddzielny szablon dla pustej galerii. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9202593034e80f15577c7bc39af7245a25aacb10?ds=inline;hp=-c Oddzielny szablon dla pustej galerii. --- 9202593034e80f15577c7bc39af7245a25aacb10 diff --git a/platforma/static/js/views/gallery.js b/platforma/static/js/views/gallery.js index 176b0abb..1808ea18 100644 --- a/platforma/static/js/views/gallery.js +++ b/platforma/static/js/views/gallery.js @@ -25,12 +25,15 @@ var ImageGalleryView = View.extend({ }, modelDataChanged: function(property, value) - { - if( property == 'data') - { - this.render(); - this.gotoPage(this.currentPage); - } + { + console.log(this.model.get('state'), value, value.length); + if ((this.model.get('state') == 'synced') && (value.length == 0)) { + console.log('tutaj'); + this.render('image-gallery-empty-template'); + } else { + this.render(); + this.gotoPage(this.currentPage); + } }, gotoPage: function(index) @@ -85,8 +88,11 @@ var ImageGalleryView = View.extend({ modelStateChanged: function(property, value) { if (value == 'loading') { - // this.freeze('Ładowanie...'); + this.freeze('Ładowanie...'); } else { + if ((value == 'synced') && (this.model.get('data').length == 0)) { + this.render('image-gallery-empty-template'); + } this.unfreeze(); } }, @@ -210,7 +216,7 @@ var ImageGalleryView = View.extend({ mousedown(this.pageDragStart.bind(this)); }, - render: function() + render: function(template) { if(!this.model) return; @@ -225,7 +231,7 @@ var ImageGalleryView = View.extend({ if(this.$zoomResetButton) this.$zoomResetButton.unbind(); /* render */ - this._super(); + this._super(template); /* fetch important parts */ this.$pageListRoot = $('.image-gallery-page-list', this.element); diff --git a/platforma/static/js/views/view.js b/platforma/static/js/views/view.js index d0c6d170..9441fc50 100644 --- a/platforma/static/js/views/view.js +++ b/platforma/static/js/views/view.js @@ -21,9 +21,9 @@ var View = Editor.Object.extend({ $(this.element).bind('resize', this._resizeHandler); }, - render: function() { + render: function(template) { console.log('rendering:', this._className); - this.element.html(render_template(this.template, this)); + this.element.html(render_template(template || this.template, this)); }, frozen: function() { diff --git a/platforma/templates/explorer/editor.html b/platforma/templates/explorer/editor.html index 2458e8e0..7bc9c617 100755 --- a/platforma/templates/explorer/editor.html +++ b/platforma/templates/explorer/editor.html @@ -133,6 +133,12 @@ + +