mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Support for PlaceholderWidget with no link
Bug: T137490 Change-Id: Ia861b5aa3f100124418956a0e09603a9ba29215a
This commit is contained in:
parent
c1b4e4d5aa
commit
c93800e17c
|
@ -11,6 +11,7 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
|
|||
}
|
||||
|
||||
public function execute() {
|
||||
|
||||
// To avoid API warning, register the parameter used to bust browser cache
|
||||
$this->getMain()->getVal( '_' );
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
@import '../echo.variables';
|
||||
.mw-echo-ui-placeholderItemWidget {
|
||||
padding: 2em;
|
||||
background-color: @notification-background-read;
|
||||
|
||||
&-notLinked,
|
||||
&-notLinked a {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
padding: 2em;
|
||||
background-color: @notification-background-read;
|
||||
}
|
||||
|
|
|
@ -19,31 +19,29 @@
|
|||
// Mixin constructor
|
||||
OO.ui.mixin.LabelElement.call( this, config );
|
||||
|
||||
this.$link = $( '<a>' )
|
||||
.addClass( 'mw-echo-ui-placeholderItemWidget-link' );
|
||||
this.setLink( config.link || '' );
|
||||
this.$element.addClass( 'mw-echo-ui-placeholderItemWidget' );
|
||||
|
||||
this.$element
|
||||
.addClass( 'mw-echo-ui-placeholderItemWidget' )
|
||||
.append(
|
||||
this.$link.append( this.$label )
|
||||
);
|
||||
this.setLink( config.link );
|
||||
};
|
||||
|
||||
OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.Widget );
|
||||
OO.mixinClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.mixin.LabelElement );
|
||||
|
||||
/**
|
||||
* Set (or unset) the main link for this widget
|
||||
* Set (or unset) the main link url for this widget
|
||||
*
|
||||
* @param {string} link The widget link
|
||||
* @param {string} url The widget url
|
||||
*/
|
||||
mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( link ) {
|
||||
this.link = link;
|
||||
|
||||
this.$element.toggleClass( 'mw-echo-ui-placeholderItemWidget-loadingOption-notLinked', !this.link );
|
||||
|
||||
this.$link.attr( 'href', this.link );
|
||||
mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( url ) {
|
||||
var $link;
|
||||
if ( url ) {
|
||||
$link = $( '<a>' )
|
||||
.addClass( 'mw-echo-ui-placeholderItemWidget-link' )
|
||||
.attr( 'href', url );
|
||||
this.$element.html( $link.append( this.$label ) );
|
||||
} else {
|
||||
this.$element.html( this.$label );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue