X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5913c54d19b8f6775633176032161d49f9b2f1aa..HEAD:/src/redakcja/static/js/wiki/dialog_revert.js diff --git a/src/redakcja/static/js/wiki/dialog_revert.js b/src/redakcja/static/js/wiki/dialog_revert.js index 4d550f9d..2af642e7 100644 --- a/src/redakcja/static/js/wiki/dialog_revert.js +++ b/src/redakcja/static/js/wiki/dialog_revert.js @@ -4,26 +4,25 @@ */ (function($) { - function RevertDialog(element, options) { - this.ctx = $.wiki.exitContext(); - this.clearForm(); + class RevertDialog 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='textrevert-revision']", this.$form).val(options.revision); + $("input[name='textrevert-revision']", this.$form).val(options.revision); + } - $.wiki.cls.GenericDialog.call(this, element); - }; + cancelAction() { + $.wiki.enterContext(this.ctx); + this.hide(); + }; - RevertDialog.prototype = new $.wiki.cls.GenericDialog(); - - RevertDialog.prototype.cancelAction = function() { - $.wiki.enterContext(this.ctx); - this.hide(); - }; - - RevertDialog.prototype.revertAction = function() { + revertAction() { var self = this; self.$elem.block({ @@ -33,7 +32,6 @@ $.wiki.blocking = self.$elem; try { - CurrentDocument.revertToVersion({ form: self.$form, success: function(e, msg) { @@ -58,7 +56,8 @@ console.log('Exception:', e) self.$elem.unblock(); } - }; /* end of revert dialog */ + } + } /* make it global */ $.wiki.cls.RevertDialog = RevertDialog;