Merge branch 'master' of stigma.nowoczesnapolska.org.pl:platforma
[redakcja.git] / platforma / static / js / models.js
index ffaf999..ba2f3ce 100755 (executable)
@@ -262,7 +262,7 @@ Editor.HTMLModel = Editor.Model.extend({
         });
     },
 
-    putXMLPart: function(elem, data) {
+    putXMLPart: function(elem, data, callback) {
         var self = this;
       
         var path = elem.attr('x-pointer');
@@ -281,7 +281,7 @@ Editor.HTMLModel = Editor.Model.extend({
                 // format: 'nl'
             },
             success: function(htmldata) {
-                elem.html(htmldata);
+                callback(elem, htmldata);
                 self.set('state', 'dirty');
             }
         });
@@ -596,10 +596,13 @@ Editor.DocumentModel = Editor.Model.extend({
     mergeCompleted: function(xhr, textStatus) {
         console.log(xhr.status, xhr.responseText);
         var response = parseXHRResponse(xhr);
-        if(response.success)
-        {
-            if( (response.data.result == 'no-op')
-             || (response.data.shared_timestamp == response.data.shared_parent_timestamp))
+        
+        if(response.success) {
+        
+            if( (response.data.result == 'no-op') ||             
+             ( response.data.shared_parent_timestamp
+               && response.data.shared_timestamp
+               && (response.data.shared_timestamp == response.data.shared_parent_timestamp)) )
             {
                 if( (response.data.revision) && (response.data.revision != this.get('revision')) )
                 {