Merge branch 'master' of stigma:platforma
[redakcja.git] / project / static / js / models.js
index 13dc2ea..5d3fac4 100644 (file)
@@ -181,7 +181,8 @@ Editor.HTMLModel = Editor.Model.extend({
 
 Editor.ImageGalleryModel = Editor.Model.extend({
   _className: 'Editor.ImageGalleryModel',
-  serverURL: null,  
+  serverURL: null,
+  data: [],
   state: 'empty',
 
   init: function(serverURL) {
@@ -208,7 +209,15 @@ Editor.ImageGalleryModel = Editor.Model.extend({
       alert('erroneous state:', this.get('state'));
     }
 
-    this.set('pages', data[0].pages);
+    $.log('galleries:', data);
+
+    if (data.length == 0)
+        this.set('data', []);
+    else {
+        $.log('dupa');
+        this.set('data', data[0].pages);
+    }  
+
     this.set('state', 'synced');
   },