2015-11-12 19:37:56 +00:00
|
|
|
( function ( mw, $ ) {
|
|
|
|
/**
|
|
|
|
* Placeholder notification option widget for echo popup.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.OptionWidget
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration object
|
2015-12-21 21:47:09 +00:00
|
|
|
* @cfg {string} [link] A link that this widget leads to.
|
2015-11-12 19:37:56 +00:00
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget = function MwEchoUiPlaceholderItemWidget( config ) {
|
2015-12-21 21:47:09 +00:00
|
|
|
config = config || {};
|
|
|
|
|
2015-11-12 19:37:56 +00:00
|
|
|
// Parent constructor
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.parent.call( this, $.extend( { data: null }, config ) );
|
|
|
|
|
2015-12-21 21:47:09 +00:00
|
|
|
this.$link = $( '<a>' )
|
|
|
|
.addClass( 'mw-echo-ui-notificationsWidget-loadingOption-link' );
|
|
|
|
this.setLink( config.link || '' );
|
|
|
|
|
|
|
|
this.$element
|
|
|
|
.addClass( 'mw-echo-ui-notificationsWidget-loadingOption' )
|
|
|
|
.append(
|
|
|
|
this.$link.append( this.$label )
|
|
|
|
);
|
2015-11-12 19:37:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.OptionWidget );
|
|
|
|
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.static.selectable = false;
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.static.highlightable = false;
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.static.pressable = false;
|
|
|
|
|
2015-12-21 21:47:09 +00:00
|
|
|
/**
|
|
|
|
* Set (or unset) the main link for this widget
|
|
|
|
*
|
|
|
|
* @param {string} link The widget link
|
|
|
|
*/
|
|
|
|
mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( link ) {
|
|
|
|
this.link = link;
|
|
|
|
|
|
|
|
this.$element.toggleClass( 'mw-echo-ui-notificationsWidget-loadingOption-notLinked', !this.link );
|
|
|
|
|
|
|
|
this.$link.attr( 'href', this.link );
|
|
|
|
};
|
|
|
|
|
2015-11-12 19:37:56 +00:00
|
|
|
} )( mediaWiki, jQuery );
|