2 * @class mw.widgets.EditRecovery.LoadNotification
4 * @extends OO.ui.Widget
6 * @param {Object} config
7 * @param {boolean} config.differentRev Whether to display the 'different revision' warning.
9 const LoadNotification = function mwWidgetsEditRecoveryLoadNotification( config ) {
10 LoadNotification.super.call( this, {} );
11 this.recoverButton = new OO.ui.ButtonWidget( {
12 label: mw.msg( 'edit-recovery-loaded-recover' ),
13 flags: [ 'progressive' ]
15 this.discardButton = new OO.ui.ButtonWidget( {
16 label: mw.msg( 'edit-recovery-loaded-discard' ),
18 flags: [ 'destructive' ]
20 const $buttons = $( '<div>' )
21 .addClass( 'mw-EditRecovery-LoadNotification-buttons' )
23 this.recoverButton.$element,
24 this.discardButton.$element
26 let differentRev = null;
27 let differentRevSave = null;
28 if ( config.differentRev ) {
29 differentRev = mw.message( 'edit-recovery-loaded-message-different-rev' ).parse();
30 differentRevSave = mw.config.get( 'wgEditSubmitButtonLabelPublish' ) ?
31 mw.message( 'edit-recovery-loaded-message-different-rev-publish' ).parse() :
32 mw.message( 'edit-recovery-loaded-message-different-rev-save' ).parse();
35 mw.message( 'edit-recovery-loaded-message' ).escaped(),
36 mw.message( 'word-separator' ).parse(),
38 mw.message( 'word-separator' ).parse(),
44 OO.inheritClass( LoadNotification, OO.ui.Widget );
48 * @return {mw.Notification}
50 LoadNotification.prototype.getNotification = function () {
51 return mw.notification.notify( this.$element, {
52 title: mw.msg( 'edit-recovery-loaded-title' ),
59 * @return {OO.ui.ButtonWidget}
61 LoadNotification.prototype.getRecoverButton = function () {
62 return this.recoverButton;
67 * @return {OO.ui.ButtonWidget}
69 LoadNotification.prototype.getDiscardButton = function () {
70 return this.discardButton;
73 module.exports = LoadNotification;