mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-15 18:29:50 +00:00
Merge "Show both Echo icons in desktop Minerva"
This commit is contained in:
commit
97e2899a90
|
@ -314,6 +314,8 @@ class Hooks implements
|
||||||
SkinOptions::MAIN_MENU_EXPANDED => $featureManager->isFeatureAvailableForCurrentUser(
|
SkinOptions::MAIN_MENU_EXPANDED => $featureManager->isFeatureAvailableForCurrentUser(
|
||||||
'MinervaAdvancedMainMenu'
|
'MinervaAdvancedMainMenu'
|
||||||
),
|
),
|
||||||
|
// In mobile, always resort to single icon.
|
||||||
|
SkinOptions::SINGLE_ECHO_BUTTON => true,
|
||||||
SkinOptions::HISTORY_IN_PAGE_ACTIONS => $isUserPageOrUserTalkPage ?
|
SkinOptions::HISTORY_IN_PAGE_ACTIONS => $isUserPageOrUserTalkPage ?
|
||||||
true : $featureManager->isFeatureAvailableForCurrentUser( 'MinervaHistoryInPageActions' ),
|
true : $featureManager->isFeatureAvailableForCurrentUser( 'MinervaHistoryInPageActions' ),
|
||||||
SkinOptions::TOOLBAR_SUBMENU => $isUserPageOrUserTalkPage ?
|
SkinOptions::TOOLBAR_SUBMENU => $isUserPageOrUserTalkPage ?
|
||||||
|
|
|
@ -36,6 +36,7 @@ final class SkinOptions {
|
||||||
public const MAIN_MENU_EXPANDED = 'mainMenuExpanded';
|
public const MAIN_MENU_EXPANDED = 'mainMenuExpanded';
|
||||||
public const PERSONAL_MENU = 'personalMenu';
|
public const PERSONAL_MENU = 'personalMenu';
|
||||||
public const SIMPLIFIED_TALK = 'simplifiedTalk';
|
public const SIMPLIFIED_TALK = 'simplifiedTalk';
|
||||||
|
public const SINGLE_ECHO_BUTTON = 'echo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note stable skin options default to true for desktop-Minerva and are expected to be
|
* Note stable skin options default to true for desktop-Minerva and are expected to be
|
||||||
|
@ -68,6 +69,8 @@ final class SkinOptions {
|
||||||
self::MAIN_MENU_EXPANDED => true,
|
self::MAIN_MENU_EXPANDED => true,
|
||||||
/** whether the simplified talk page is eligible to be shown */
|
/** whether the simplified talk page is eligible to be shown */
|
||||||
self::SIMPLIFIED_TALK => false,
|
self::SIMPLIFIED_TALK => false,
|
||||||
|
/** whether Echo should be replaced with a single button */
|
||||||
|
self::SINGLE_ECHO_BUTTON => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<nav class="minerva-user-navigation" aria-label="{{msg-minerva-user-navigation}}">
|
<nav class="minerva-user-navigation" aria-label="{{msg-minerva-user-navigation}}">
|
||||||
{{^is-anon}}
|
{{^is-anon}}
|
||||||
<div class="minerva-user-notifications"
|
<div class="minerva-user-notifications"
|
||||||
id="pt-notifications-alert">
|
{{#is-minerva-echo-single-button}}id="pt-notifications-alert"{{/is-minerva-echo-single-button}}>
|
||||||
{{#data-portlets.data-notifications}}
|
{{#data-portlets.data-notifications}}
|
||||||
<ul>{{{html-items}}}</ul>
|
<ul>{{{html-items}}}</ul>
|
||||||
{{/data-portlets.data-notifications}}
|
{{/data-portlets.data-notifications}}
|
||||||
|
|
|
@ -262,12 +262,13 @@ class SkinMinerva extends SkinMustache {
|
||||||
$contentNavigationUrls['associated-pages'][ $id ]['rel'] = 'discussion';
|
$contentNavigationUrls['associated-pages'][ $id ]['rel'] = 'discussion';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$skinOptions = $this->getSkinOptions();
|
||||||
$this->contentNavigationUrls = $contentNavigationUrls;
|
$this->contentNavigationUrls = $contentNavigationUrls;
|
||||||
if ( $this->getUser()->isRegistered() ) {
|
if ( $this->getUser()->isRegistered() ) {
|
||||||
if ( count( $contentNavigationUrls['notifications'] ) === 0 ) {
|
if ( count( $contentNavigationUrls['notifications'] ) === 0 ) {
|
||||||
// Shown to logged in users when Echo is not installed:
|
// Shown to logged in users when Echo is not installed:
|
||||||
$contentNavigationUrls['notifications']['mytalks'] = $this->getNotificationFallbackButton();
|
$contentNavigationUrls['notifications']['mytalks'] = $this->getNotificationFallbackButton();
|
||||||
} else {
|
} elseif ( $skinOptions->get( SkinOptions::SINGLE_ECHO_BUTTON ) ) {
|
||||||
// Combine notification icons. Minerva only shows one entry point to notifications.
|
// Combine notification icons. Minerva only shows one entry point to notifications.
|
||||||
// This can be reconsidered with a solution to https://phabricator.wikimedia.org/T142981
|
// This can be reconsidered with a solution to https://phabricator.wikimedia.org/T142981
|
||||||
$alert = $contentNavigationUrls['notifications']['notifications-alert'] ?? null;
|
$alert = $contentNavigationUrls['notifications']['notifications-alert'] ?? null;
|
||||||
|
@ -277,6 +278,19 @@ class SkinMinerva extends SkinMustache {
|
||||||
$contentNavigationUrls['notifications']['notifications-alert'] =
|
$contentNavigationUrls['notifications']['notifications-alert'] =
|
||||||
$this->getCombinedNotificationButton( $alert, $notice );
|
$this->getCombinedNotificationButton( $alert, $notice );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Show desktop alert icon.
|
||||||
|
$alert = $contentNavigationUrls['notifications']['notifications-alert'] ?? null;
|
||||||
|
if ( $alert ) {
|
||||||
|
// Correct the icon to be the bell filled rather than the outline to match
|
||||||
|
// Echo's badge.
|
||||||
|
$linkClass = $alert['link-class'] ?? [];
|
||||||
|
$alert['link-class'] = array_map( static function ( $class ) {
|
||||||
|
return $class === 'oo-ui-icon-bellOutline' ?
|
||||||
|
'oo-ui-icon-bell' : $class;
|
||||||
|
}, $linkClass );
|
||||||
|
$contentNavigationUrls['notifications']['notifications-alert'] = $alert;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,6 +300,7 @@ class SkinMinerva extends SkinMustache {
|
||||||
*/
|
*/
|
||||||
public function getTemplateData(): array {
|
public function getTemplateData(): array {
|
||||||
$data = parent::getTemplateData();
|
$data = parent::getTemplateData();
|
||||||
|
$skinOptions = $this->getSkinOptions();
|
||||||
// FIXME: Can we use $data instead of calling buildContentNavigationUrls ?
|
// FIXME: Can we use $data instead of calling buildContentNavigationUrls ?
|
||||||
$nav = $this->contentNavigationUrls;
|
$nav = $this->contentNavigationUrls;
|
||||||
if ( $nav === null ) {
|
if ( $nav === null ) {
|
||||||
|
@ -323,6 +338,7 @@ class SkinMinerva extends SkinMustache {
|
||||||
: '',
|
: '',
|
||||||
'html-minerva-user-menu' => $this->getPersonalToolsMenu( $nav['user-menu'] ),
|
'html-minerva-user-menu' => $this->getPersonalToolsMenu( $nav['user-menu'] ),
|
||||||
'is-minerva-beta' => $this->getSkinOptions()->get( SkinOptions::BETA_MODE ),
|
'is-minerva-beta' => $this->getSkinOptions()->get( SkinOptions::BETA_MODE ),
|
||||||
|
'is-minerva-echo-single-button' => $skinOptions->get( SkinOptions::SINGLE_ECHO_BUTTON ),
|
||||||
'data-minerva-tabs' => $this->getTabsData( $nav ),
|
'data-minerva-tabs' => $this->getTabsData( $nav ),
|
||||||
'data-minerva-page-actions' => $this->getPageActions( $nav ),
|
'data-minerva-page-actions' => $this->getPageActions( $nav ),
|
||||||
'data-minerva-secondary-actions' => $this->getSecondaryActions( $nav ),
|
'data-minerva-secondary-actions' => $this->getSecondaryActions( $nav ),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@import '../../minerva.less/minerva.variables.less';
|
@import '../../minerva.less/minerva.variables.less';
|
||||||
|
// stylelint-disable selector-max-id
|
||||||
|
|
||||||
// The top level user account button in the upper right near the notifications button.
|
// The top level user account button in the upper right near the notifications button.
|
||||||
.minerva-user-navigation {
|
.minerva-user-navigation {
|
||||||
|
@ -21,6 +22,28 @@
|
||||||
& > *:last-child {
|
& > *:last-child {
|
||||||
margin-right: -@icon-padding-md;
|
margin-right: -@icon-padding-md;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// desktop mode modifications
|
||||||
|
.minerva-user-notifications {
|
||||||
|
ul {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pt-notifications-alert {
|
||||||
|
margin-right: 20px;
|
||||||
|
|
||||||
|
&.mw-echo-ui-notificationBadgeButtonPopupWidget {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li#pt-notifications-notice,
|
||||||
|
li#pt-notifications-alert {
|
||||||
|
display: block;
|
||||||
|
width: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Different rule for cached HTML
|
// Different rule for cached HTML
|
||||||
|
|
Loading…
Reference in a new issue