Merge "Link project labels in xwiki bundle to their Special:Notifications page"

This commit is contained in:
jenkins-bot 2016-05-16 20:47:32 +00:00 committed by Gerrit Code Review
commit 942f79d55d
5 changed files with 39 additions and 15 deletions

View file

@ -201,10 +201,13 @@ class EchoForeignNotifications {
list( $major, $minor ) = $siteFromDB;
$server = $wgConf->get( 'wgServer', $wiki, $major, array( 'lang' => $minor, 'site' => $major ) );
$scriptPath = $wgConf->get( 'wgScriptPath', $wiki, $major, array( 'lang' => $minor, 'site' => $major ) );
$articlePath = $wgConf->get( 'wgArticlePath', $wiki, $major, array( 'lang' => $minor, 'site' => $major ) );
$data[$wiki] = array(
'title' => static::getWikiTitle( $wiki, $siteFromDB ),
'url' => wfExpandUrl( $server . $scriptPath . '/api.php', PROTO_INTERNAL ),
// We need this to link to Special:Notifications page
'base' => wfExpandUrl( $server . $articlePath, PROTO_INTERNAL ),
);
}

View file

@ -34,8 +34,10 @@
}
);
this.title = new OO.ui.LabelWidget( {
classes: [ 'mw-echo-ui-bundledNotificationGroupWidget-title' ]
this.title = new OO.ui.ButtonWidget( {
framed: false,
classes: [ 'mw-echo-ui-bundledNotificationGroupWidget-title' ],
href: this.model.getSourceArticleUrl().replace( '$1', 'Special:Notifications' )
} );
if ( this.model.getTitle() ) {

View file

@ -30,7 +30,7 @@
// work
.css( 'display', 'none' );
this.showTitles = false;
this.showTitles = true;
this.expanded = false;
// Add "expand" button
@ -63,6 +63,8 @@
// Initialization
this.populateFromModel();
this.toggleExpanded( false );
this.toggleTitles( true );
this.$element
.addClass( 'mw-echo-ui-notificationGroupItemWidget' )
.append(
@ -106,8 +108,6 @@
],
index
);
this.checkShowTitles();
};
/**
@ -180,7 +180,6 @@
}
this.addItems( widgets );
this.checkShowTitles();
};
/**
@ -212,20 +211,29 @@
};
/**
* Check whether the titles should be shown and toggle them in the items.
* Toggle the visibility of the titles
*
* @param {boolean} [show] Show titles
*/
mw.echo.ui.NotificationGroupItemWidget.prototype.checkShowTitles = function () {
mw.echo.ui.NotificationGroupItemWidget.prototype.toggleTitles = function ( show ) {
var i,
items = this.getItems(),
numItems = items.length,
showTitles = numItems > 1;
items = this.getItems();
if ( this.showTitles !== showTitles ) {
this.showTitles = showTitles;
for ( i = 0; i < numItems; i++ ) {
items[ i ].toggleTitle( showTitles );
show = show === undefined ? !this.showTitles : show;
if ( this.showTitles !== show ) {
this.showTitles = show;
for ( i = 0; i < items.length; i++ ) {
items[ i ].toggleTitle( show );
}
}
};
/**
* Check whether the titles should be shown and toggle them in the items.
*/
mw.echo.ui.NotificationGroupItemWidget.prototype.checkShowTitles = function () {
this.toggleTitles( this.getItemCount() > 1 );
};
} )( mediaWiki, jQuery );

View file

@ -64,6 +64,7 @@
{
type: this.getType(),
source: source,
sourceArticleURL: this.sources[ source ].base,
foreign: this.isForeign(),
title: this.sources[ source ].title,
removeReadNotifications: this.removeReadNotifications,

View file

@ -39,6 +39,7 @@
this.type = config.type || 'alert';
this.source = config.source || 'local';
this.sourceArticleURL = config.sourceArticleURL;
this.id = config.id || this.source;
this.title = config.title || '';
this.fallbackTimestamp = config.timestamp;
@ -686,6 +687,15 @@
return this.source;
};
/**
* Get the article path for this source
*
* @return {string} URL for the article path
*/
mw.echo.dm.NotificationsModel.prototype.getSourceArticleUrl = function () {
return this.sourceArticleURL;
};
/**
* Get the title of this model
*