X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5913c54d19b8f6775633176032161d49f9b2f1aa..69b332800a472211b5da70426171fa429702a273:/src/redakcja/static/js/wiki/dialog_save.js diff --git a/src/redakcja/static/js/wiki/dialog_save.js b/src/redakcja/static/js/wiki/dialog_save.js index 903c0e1c..03baa0ff 100644 --- a/src/redakcja/static/js/wiki/dialog_save.js +++ b/src/redakcja/static/js/wiki/dialog_save.js @@ -4,61 +4,61 @@ */ (function($) { - function SaveDialog(element) { - this.ctx = $.wiki.exitContext(); - this.clearForm(); + class SaveDialog extends $.wiki.cls.GenericDialog { + constructor(element, options) { + let ctx = $.wiki.exitContext(); + super(element); + this.ctx = ctx; + this.clearForm(); - /* fill out hidden fields */ - this.$form = $('form', element); + /* fill out hidden fields */ + this.$form = $('form', element); - $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision); + $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision); + } - $.wiki.cls.GenericDialog.call(this, element); - }; + cancelAction() { + $.wiki.enterContext(this.ctx); + this.hide(); + } - SaveDialog.prototype = new $.wiki.cls.GenericDialog(); + saveAction() { + var self = this; - SaveDialog.prototype.cancelAction = function() { - $.wiki.enterContext(this.ctx); - this.hide(); - }; - - SaveDialog.prototype.saveAction = function() { - var self = this; - - self.$elem.block({ - message: "Zapisywanie...
", - fadeIn: 0, - }); + self.$elem.block({ + message: "Zapisywanie...
", + fadeIn: 0, + }); $.wiki.blocking = self.$elem; - try { + try { - CurrentDocument.save({ - form: self.$form, - success: function(doc, changed, info){ - self.$elem.block({ - message: info, - timeout: 2000, - fadeOut: 0, - onUnblock: function() { - self.hide(); - $.wiki.enterContext(self.ctx); - } - }); - }, - failure: function(doc, info) { - console.log("Failure", info); - self.reportErrors(info); - self.$elem.unblock(); - } - }); - } catch(e) { - console.log('Exception:', e) - self.$elem.unblock(); - } - }; /* end of save dialog */ + CurrentDocument.save({ + form: self.$form, + success: function(doc, changed, info){ + self.$elem.block({ + message: info, + timeout: 2000, + fadeOut: 0, + onUnblock: function() { + self.hide(); + $.wiki.enterContext(self.ctx); + } + }); + }, + failure: function(doc, info) { + console.log("Failure", info); + self.reportErrors(info); + self.$elem.unblock(); + } + }); + } catch(e) { + console.log('Exception:', e) + self.$elem.unblock(); + } + } + } - /* make it global */ - $.wiki.cls.SaveDialog = SaveDialog; + /* make it global */ + $.wiki.cls.SaveDialog = SaveDialog; })(jQuery);