2018-11-12 13:56:38 +00:00
|
|
|
( function () {
|
2016-04-10 13:31:02 +00:00
|
|
|
/**
|
|
|
|
* Placeholder notification option widget for echo popup.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.Widget
|
2024-04-30 14:21:54 +00:00
|
|
|
* @mixes OO.ui.mixin.LabelElement
|
2016-04-10 13:31:02 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration object
|
2024-05-27 01:43:21 +00:00
|
|
|
* @param {string} [config.link] A link that this widget leads to.
|
2016-04-10 13:31:02 +00:00
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget = function MwEchoUiPlaceholderItemWidget( config ) {
|
|
|
|
config = config || {};
|
|
|
|
|
|
|
|
// Parent constructor
|
2018-05-22 14:56:46 +00:00
|
|
|
mw.echo.ui.PlaceholderItemWidget.super.call( this, $.extend( { data: null }, config ) );
|
2016-04-10 13:31:02 +00:00
|
|
|
|
|
|
|
// Mixin constructor
|
|
|
|
OO.ui.mixin.LabelElement.call( this, config );
|
|
|
|
|
2016-06-21 11:46:06 +00:00
|
|
|
this.$element.addClass( 'mw-echo-ui-placeholderItemWidget' );
|
2016-04-10 13:31:02 +00:00
|
|
|
|
2016-06-21 11:46:06 +00:00
|
|
|
this.setLink( config.link );
|
2016-04-10 13:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.Widget );
|
|
|
|
OO.mixinClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.mixin.LabelElement );
|
|
|
|
|
|
|
|
/**
|
2016-06-21 11:46:06 +00:00
|
|
|
* Set (or unset) the main link url for this widget
|
2016-04-10 13:31:02 +00:00
|
|
|
*
|
2018-05-22 14:57:23 +00:00
|
|
|
* @param {string} [url] The widget url
|
2016-04-10 13:31:02 +00:00
|
|
|
*/
|
2016-06-21 11:46:06 +00:00
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( url ) {
|
|
|
|
if ( url ) {
|
2024-06-03 12:22:48 +00:00
|
|
|
const $link = $( '<a>' )
|
2016-06-21 11:46:06 +00:00
|
|
|
.addClass( 'mw-echo-ui-placeholderItemWidget-link' )
|
|
|
|
.attr( 'href', url );
|
|
|
|
this.$element.html( $link.append( this.$label ) );
|
|
|
|
} else {
|
|
|
|
this.$element.html( this.$label );
|
|
|
|
}
|
2016-04-10 13:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return false on 'isRead' call for the notification list
|
|
|
|
* sorting.
|
|
|
|
*
|
|
|
|
* @return {boolean} false
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.isRead = function () {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return false on 'isForeign' call for the notification list
|
|
|
|
* sorting.
|
|
|
|
*
|
|
|
|
* @return {boolean} false
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.isForeign = function () {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return 0 on getTimestamp call for the notification list
|
|
|
|
* sorting.
|
|
|
|
*
|
|
|
|
* @return {number} 0
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.getTimestamp = function () {
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return 0 on getId call for the notification list
|
|
|
|
* sorting.
|
|
|
|
*
|
|
|
|
* @return {number} 0
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.getId = function () {
|
|
|
|
return 0;
|
|
|
|
};
|
2016-05-29 20:49:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do nothing for resetInitiallyUnseen since it is requested by the list widget
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.resetInitiallyUnseen = function () {};
|
|
|
|
|
2018-11-12 13:56:38 +00:00
|
|
|
}() );
|