X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8fabff2f05c0e1a5a3075d2e5f4293fa29029c3a..94ecd7a5d671af98be2ec7cf33605ae4d42c251a:/project/static/js/editor.js?ds=inline diff --git a/project/static/js/editor.js b/project/static/js/editor.js index a3d96593..c12182f3 100644 --- a/project/static/js/editor.js +++ b/project/static/js/editor.js @@ -51,6 +51,7 @@ Panel.prototype.load = function (url) { }, error: function(request, textStatus, errorThrown) { $.log('ajax', url, this.target, 'error:', textStatus, errorThrown); + $(self.contentDiv).html("
WystapiÅ bÅÄ d podczas wczytywania panelu."); } }); } @@ -144,7 +145,8 @@ Editor.prototype.loadConfig = function() { panels: [ {name: 'htmleditor', ratio: 0.5}, {name: 'gallery', ratio: 0.5} - ] + ], + lastUpdate: 0, } try { @@ -196,6 +198,7 @@ Editor.prototype.savePanelOptions = function() { }) }); self.options.panels = panels; + self.options.lastUpdate = (new Date()).getTime() / 1000; $.log($.toJSON(self.options)); $.cookie('options', $.toJSON(self.options), { expires: 7, path: '/'}); } @@ -206,7 +209,7 @@ Editor.prototype.saveToBranch = function(msg) var self = this; $.log('Saving to local branch - panel:', changed_panel); - if(!msg) msg = "Zapis z edytora platformy."; + if(!msg) msg = "Zapis z edytora platformy."; if( changed_panel.length == 0) { $.log('Nothing to save.'); @@ -219,7 +222,13 @@ Editor.prototype.saveToBranch = function(msg) } saveInfo = changed_panel.data('ctrl').saveInfo(); - $.extend(saveInfo.postData, {'commit_message': msg}); + var postData = '' + if(saveInfo.postData instanceof Object) + postData = $.param(saveInfo.postData); + else + postData = saveInfo.postData; + + postData += '&' + $.param({'commit_message': msg}) $.ajax({ url: saveInfo.url, @@ -241,7 +250,7 @@ Editor.prototype.saveToBranch = function(msg) self.showPopup('save-error'); }, type: 'POST', - data: saveInfo.postData + data: postData }); return true; @@ -262,7 +271,7 @@ Editor.prototype.onContentChanged = function(event, data) { $('#toolbar-button-commit').attr('disabled', 'disabled'); if(this.autosaveTimer) return; - this.autosaveTimer = setTimeout( function() { self.autoSave(); }, 5000 ); + this.autosaveTimer = setTimeout( function() { self.autoSave(); }, 300000 ); }; Editor.prototype.refreshPanels = function(goodPanel) {