X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3546a2b2d5f52224bcf95803030611ab505f29cd..663d1c8f22c26b51c0c132388cde9d28fa6eeef0:/project/static/js/models.js diff --git a/project/static/js/models.js b/project/static/js/models.js index 13dc2ea0..b5b9c541 100644 --- a/project/static/js/models.js +++ b/project/static/js/models.js @@ -82,7 +82,7 @@ Editor.XMLModel = Editor.Model.extend({ $.ajax({ url: this.serverURL, - type: 'put', + type: 'post', dataType: 'json', data: payload, success: this.updatingSucceeded.bind(this), @@ -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); + console.log('galleries:', data); + + if (data.length === 0) { + this.set('data', []); + } else { + console.log('dupa'); + this.set('data', data[0].pages); + } + this.set('state', 'synced'); }, @@ -310,7 +319,7 @@ Editor.DocumentModel = Editor.Model.extend({ this.contentModels[key].set('revision', this.data.user_revision); this.contentModels[key].set('state', 'empty'); } - } else if (xhr.status == 202) { // Wygenerowano PullRequest + } else if (xhr.status == 202) { // Wygenerowano PullRequest (tutaj?) } else if (xhr.status == 204) { // Nic nie zmieniono } else if (xhr.status == 409) { // Konflikt podczas operacji } @@ -342,7 +351,7 @@ Editor.DocumentModel = Editor.Model.extend({ this.contentModels[key].set('revision', this.data.user_revision); this.contentModels[key].set('state', 'empty'); } - } else if (xhr.status == 202) { // Wygenerowano PullRequest (tutaj?) + } else if (xhr.status == 202) { // Wygenerowano PullRequest } else if (xhr.status == 204) { // Nic nie zmieniono } else if (xhr.status == 409) { // Konflikt podczas operacji }