X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/02a98d2af6f1fabf567b575c5f2d818688af1594..1b8ab1430082a145a3e4807de837dcc1568178a3:/platforma/static/js/wiki/save_dialog.js diff --git a/platforma/static/js/wiki/save_dialog.js b/platforma/static/js/wiki/save_dialog.js new file mode 100644 index 00000000..827b26b2 --- /dev/null +++ b/platforma/static/js/wiki/save_dialog.js @@ -0,0 +1,50 @@ +/* + * Dialog for saving document to the server + * + */ +(function($) { + + function SaveDialog(element) { + $.wiki.cls.GenericDialog.call(this, element); + this.ctx = $.wiki.exitContext(); + }; + + SaveDialog.prototype = new $.wiki.cls.GenericDialog(); + + SaveDialog.prototype + + SaveDialog.prototype.saveAction = function() { + var self = this; + + self.$elem.block({ + message: "Zapisywanie..." + }); + + try { + + CurrentDocument.save({ + comment: $("#komentarz").text(), + success: function(doc, changed, info){ + self.$elem.block({ + message: info, + timeout: 1000, + fadeOut: 0, + onUnblock: function() { + self.hide(); + } + }); + }, + failure: function(doc, info) { + self.reportErrors(info); + self.$elem.unblock(); + } + }); + } catch(e) { + console.log('Exception:', e) + self.$elem.unblock(); + } + }; /* end of save dialog */ + + /* make it global */ + $.wiki.cls.SaveDialog = SaveDialog; +})(jQuery);