Poprawienie logiki render w ImageGalleryView.
authorzuber <marek@stepniowski.com>
Thu, 5 Nov 2009 15:09:10 +0000 (16:09 +0100)
committerzuber <marek@stepniowski.com>
Thu, 5 Nov 2009 15:09:10 +0000 (16:09 +0100)
platforma/static/js/views/gallery.js

index 1808ea1..d3398ce 100644 (file)
@@ -218,21 +218,22 @@ var ImageGalleryView = View.extend({
 
   render: function(template) 
   {
 
   render: function(template) 
   {
-      if(!this.model) return;            
-      
-      /* first unbind all */    
-      if(this.$nextButton) this.$nextButton.unbind();
-      if(this.$prevButton) this.$prevButton.unbind();
-      if(this.$jumpButton) this.$jumpButton.unbind();
-      if(this.$pageInput) this.$pageInput.unbind();
-
-      if(this.$zoomInButton) this.$zoomInButton.unbind();
-      if(this.$zoomOutButton) this.$zoomOutButton.unbind();
-      if(this.$zoomResetButton) this.$zoomResetButton.unbind();
-
+    if(!this.model) return;            
+    
+    /* first unbind all */    
+    if(this.$nextButton) this.$nextButton.unbind();
+    if(this.$prevButton) this.$prevButton.unbind();
+    if(this.$jumpButton) this.$jumpButton.unbind();
+    if(this.$pageInput) this.$pageInput.unbind();
+
+    if(this.$zoomInButton) this.$zoomInButton.unbind();
+    if(this.$zoomOutButton) this.$zoomOutButton.unbind();
+    if(this.$zoomResetButton) this.$zoomResetButton.unbind();
+    
+    if (!template) {
       /* render */
       /* render */
-      this._super(template);
-
+      this._super();
+      
       /* fetch important parts */
       this.$pageListRoot = $('.image-gallery-page-list', this.element);
       this.$pages = $('.image-gallery-page-container', this.$pageListRoot);
       /* fetch important parts */
       this.$pageListRoot = $('.image-gallery-page-list', this.element);
       this.$pages = $('.image-gallery-page-container', this.$pageListRoot);
@@ -258,6 +259,9 @@ var ImageGalleryView = View.extend({
 
       this.gotoPage(this.currentPage);
       this.changePageZoom(this.pageZoom);
 
       this.gotoPage(this.currentPage);
       this.changePageZoom(this.pageZoom);
+    } else {
+      this._super(template);
+    }
   },
 
   jumpToPage: function() {     
   },
 
   jumpToPage: function() {