Debian Codegraph @

extensions/WikiEditor/modules/realtimepreview/ErrorLayout.js

raw symbols SCIP
1 /**
2 * This is a layout for displaying an error message.
3 *
4 * @class
5 * @constructor
6 * @extends OO.ui.Layout
7 * @param {Object} [config] Configuration options
8 */
9 function ErrorLayout( config ) {
10 config = config || {};
11 ErrorLayout.super.call( this, config );
12
13 var $image = $( '<div>' ).addClass( 'ext-WikiEditor-image-realtimepreview-error' );
14 var $title = $( '<h3>' ).text( mw.msg( 'wikieditor-realtimepreview-error' ) );
15 this.$message = $( '<div>' ).addClass( 'ext-WikiEditor-realtimepreview-error-msg' );
16 this.reloadButton = new OO.ui.ButtonWidget( {
17 icon: 'reload',
18 label: mw.msg( 'wikieditor-realtimepreview-reload' ),
19 framed: false
20 } );
21
22 this.$element.addClass( 'ext-WikiEditor-realtimepreview-ErrorLayout' );
23 this.$element.append( $image, $title, this.$message, this.reloadButton.$element );
24 }
25
26 OO.inheritClass( ErrorLayout, OO.ui.Layout );
27
28 /**
29 * @public
30 * @return {OO.ui.ButtonWidget}
31 */
32 ErrorLayout.prototype.getReloadButton = function () {
33 return this.reloadButton;
34 };
35
36 /**
37 * Set the displayed error message.
38 *
39 * @public
40 * @param {jQuery} $errorMsg The message to display.
41 */
42 ErrorLayout.prototype.setMessage = function ( $errorMsg ) {
43 this.$message
44 .empty()
45 .append( $errorMsg );
46 };
47
48 module.exports = ErrorLayout;