mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-23 10:19:05 +00:00
Remove primary/secondary menu items, instead add a separate log out menu item
Bug: T293041 Change-Id: I9f73fdba1856dd9e0ea7120df0fb18061337961a
This commit is contained in:
parent
7af2df060f
commit
ef4aa95ae2
|
@ -41,12 +41,7 @@ final class AuthMenuEntry extends CompositeMenuEntry implements IProfileMenuEntr
|
|||
) {
|
||||
$this->profileMenuEntry = new ProfileMenuEntry( $user );
|
||||
$entries = $user->isRegistered()
|
||||
? [
|
||||
$this->profileMenuEntry,
|
||||
new LogOutMenuEntry(
|
||||
$messageLocalizer, $authLinksQuery, 'element', 'truncated-text secondary-action'
|
||||
)
|
||||
]
|
||||
? [ $this->profileMenuEntry ]
|
||||
: [ new LogInMenuEntry( $messageLocalizer, $authLinksQuery ) ];
|
||||
parent::__construct( $entries );
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ final class ProfileMenuEntry implements IProfileMenuEntry {
|
|||
'icon' => 'wikimedia-userAvatar-base20',
|
||||
'text' => $this->customProfileLabel ?? $username,
|
||||
'href' => $this->customProfileURL ?? Title::newFromText( $username, NS_USER )->getLocalURL(),
|
||||
'class' => 'menu__item--user',
|
||||
'data-event-name' => 'menu.' . (
|
||||
$this->profileTrackingCode ?? self::DEFAULT_PROFILE_TRACKING_CODE )
|
||||
] ];
|
||||
|
|
|
@ -79,9 +79,13 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
|
|||
|
||||
$groups = [
|
||||
BuilderUtil::getDiscoveryTools( $this->definitions ),
|
||||
$this->getPersonalTools(),
|
||||
BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ),
|
||||
$this->getPersonalTools( $this->showMobileOptions ),
|
||||
];
|
||||
|
||||
if ( !$this->user->isRegistered() ) {
|
||||
$groups[] = BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions );
|
||||
}
|
||||
|
||||
if ( $donate ) {
|
||||
$groups[] = $donate;
|
||||
}
|
||||
|
@ -101,11 +105,12 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
|
|||
*
|
||||
* ... by adding the Watchlist, Settings, and Log{in,out} menu items in the given order.
|
||||
*
|
||||
* @param bool $showMobileOptions Show MobileOptions instead of Preferences
|
||||
* @return Group
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
*/
|
||||
private function getPersonalTools(): Group {
|
||||
private function getPersonalTools( $showMobileOptions ): Group {
|
||||
$group = new Group( 'p-personal' );
|
||||
|
||||
$this->definitions->insertAuthMenuItem( $group );
|
||||
|
@ -113,6 +118,10 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
|
|||
if ( $this->user->isRegistered() ) {
|
||||
$this->definitions->insertWatchlistMenuItem( $group );
|
||||
$this->definitions->insertContributionsMenuItem( $group );
|
||||
$showMobileOptions ? // Identical logic as BuilderUtil::getConfigurationTools
|
||||
$this->definitions->insertMobileOptionsItem( $group ) :
|
||||
$this->definitions->insertPreferencesItem( $group );
|
||||
$this->definitions->insertLogoutMenuItem( $group );
|
||||
}
|
||||
|
||||
// Allow other extensions to add or override tools
|
||||
|
|
|
@ -6,23 +6,6 @@
|
|||
|
||||
// .menu
|
||||
#mw-mf-page-left {
|
||||
.secondary-action {
|
||||
border: 0;
|
||||
// T170362 - reset font size
|
||||
font-size: 16px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
border-left: 1px solid @grayMediumLight;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.primary-action {
|
||||
// 1px for the logout icon border-left
|
||||
margin-right: @iconSize + @iconGutterWidth * 2;
|
||||
}
|
||||
|
||||
ul {
|
||||
&:first-child {
|
||||
li:first-child {
|
||||
|
@ -53,11 +36,6 @@
|
|||
max-width: 100%;
|
||||
padding: @menuLinkLineHeight / 2 10px @menuLinkLineHeight / 2 15px;
|
||||
|
||||
// T233166
|
||||
&.secondary-action {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
box-shadow: inset 4px 0 0 0 @colorProgressive;
|
||||
text-decoration: none;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Used by last modified and Main Menu items
|
||||
// Used by last modified bar and in MobileFrontend (i.e. MobileSpecialPageFeed.php, ImageCarousel.js)
|
||||
.truncated-text {
|
||||
.text-overflow( @visible: false );
|
||||
}
|
||||
|
|
|
@ -182,14 +182,14 @@ class GroupTest extends \MediaWikiIntegrationTestCase {
|
|||
'text' => 'Phuedx (WMF)',
|
||||
'href' => '/wiki/User:Phuedx_(WMF)',
|
||||
'class' =>
|
||||
'mw-ui-icon mw-ui-icon-before mw-ui-icon-profile truncated-text primary-action',
|
||||
'mw-ui-icon mw-ui-icon-before mw-ui-icon-profile',
|
||||
'icon' => null,
|
||||
];
|
||||
$authLogoutComponent = [
|
||||
'text' => 'Logout',
|
||||
'href' => '/wiki/Special:UserLogout',
|
||||
'class' =>
|
||||
'mw-ui-icon mw-ui-icon-element secondary-logout secondary-action truncated-text',
|
||||
'mw-ui-icon mw-ui-icon-element secondary-logout',
|
||||
'icon' => null,
|
||||
];
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ const iClickOnTheMainNavigationButton = () => {
|
|||
};
|
||||
|
||||
const iShouldSeeAUserPageLinkInMenu = () => {
|
||||
ArticlePage.menu_element.$( '.primary-action' );
|
||||
ArticlePage.menu_element.$( '.menu__item--user' );
|
||||
};
|
||||
|
||||
const iShouldSeeLogoutLinkInMenu = () => {
|
||||
ArticlePage.menu_element.$( '.secondary-action' );
|
||||
ArticlePage.menu_element.$( '.menu__item--logout' );
|
||||
};
|
||||
|
||||
const iShouldSeeALinkInMenu = ( text ) => {
|
||||
|
|
Loading…
Reference in a new issue