Phuedx has uploaded a new change for review.
https://gerrit.wikimedia.org/r/301352
Change subject: Promote and flag the new action bar styles
......................................................................
Promote and flag the new action bar styles
Changes:
* If the $wgMinervaUseNewAction configuration variable is truthy, then
add a CSS feature flag that enables the new action bar styles
* Deliver styles for the new and old action styles as the complexity of
conditionally delivering an asset is outweighed by the fact that the
feature flag is a temporary measure and that the increase in
compressed file size is ~240 bytes
Bug: T140260
Change-Id: I4f4ddf9ec313605c90ff76d22bf0eeaaad6ba7d8
---
M extension.json
M includes/MobileFrontend.hooks.php
M includes/skins/SkinMinervaBeta.php
M resources/skins.minerva.base.styles/pageactions.less
D resources/skins.minerva.beta.styles/pageactions.less
R resources/skins.minerva.icons.images/languageSwitcher.svg
6 files changed, 95 insertions(+), 80 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/52/301352/1
diff --git a/extension.json b/extension.json
index 21c7e81..ce5cdd8 100644
--- a/extension.json
+++ b/extension.json
@@ -133,16 +133,6 @@
"resources/skins.minerva.base.styles/print.less"
]
},
- "skins.minerva.beta.styles": {
- "targets": [
- "mobile",
- "desktop"
- ],
- "position": "top",
- "styles": [
-
"resources/skins.minerva.beta.styles/pageactions.less"
- ]
- },
"skins.minerva.content.styles": {
"targets": [
"mobile",
@@ -203,15 +193,8 @@
"mainmenu":
"resources/skins.minerva.icons.images/hamburger.svg",
"edit":
"resources/skins.minerva.icons.images/editLocked.svg",
"edit-enabled":
"resources/skins.minerva.icons.images/edit.svg",
- "magnifying-glass-white":
"resources/skins.minerva.icons.images/magnifying-glass-white.svg"
- }
- },
- "skins.minerva.icons.beta.images": {
- "class": "ResourceLoaderImageModule",
- "prefix": "mw-ui",
- "selector": ".mw-ui-icon-{name}:before",
- "images": {
- "language-switcher":
"resources/skins.minerva.icons.beta.images/languageSwitcher.svg"
+ "magnifying-glass-white":
"resources/skins.minerva.icons.images/magnifying-glass-white.svg",
+ "language-switcher":
"resources/skins.minerva.icons.images/languageSwitcher.svg"
}
},
"mobile.overlay.images": {
@@ -1914,6 +1897,9 @@
"OutputPageParserOutput": [
"MobileFrontendHooks::onOutputPageParserOutput"
],
+ "OutputPageBodyAttributes": [
+ "MobileFrontendHooks::onOutputPageBodyAttributes"
+ ],
"HTMLFileCache::useFileCache": [
"MobileFrontendHooks::onHTMLFileCache_useFileCache"
],
@@ -2051,6 +2037,7 @@
"MFAllowNonJavaScriptEditing": false,
"MinervaAlwaysShowLanguageButton": true,
"MinervaBottomLanguageButton": true,
+ "MinervaUseNewActionBar": false,
"MFStripResponsiveImages": true,
"MFResponsiveImageWhitelist": [
"image/svg+xml"
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 7900e5e..1d98dd8 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -1267,6 +1267,33 @@
}
/**
+ * OutputPageBodyAttributes hook handler.
+ *
+ * If the new action bar is enabled, via the
<code>$wgMinervaUseNewActionBar</code>, then the
+ * <code>new-action-bar</code> CSS feature flag is added to the
<code>body</code> tag.
+ *
+ * @see
https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBodyAttributes
+ *
+ * @param OutputPage $outputPage
+ * @param Skin $skin
+ * @param array $bodyAttrs
+ */
+ public static function onOutputPageBodyAttributes(
+ OutputPage $outputPage,
+ Skin $skin,
+ array &$bodyAttributes
+ ) {
+ $context = MobileContext::singleton();
+ $config = $context->getMFConfig();
+
+ // TODO: Remove this when the new action bar is actually
considered stable (see T140260 for more
+ // detail).
+ if ( $config->get( 'MinervaUseNewActionBar' ) ) {
+ $bodyAttributes['class'] .= ' new-action-bar';
+ }
+ }
+
+ /**
* HTMLFileCache::useFileCache hook handler
* Disables file caching for mobile pageviews
* @see
https://www.mediawiki.org/wiki/Manual:Hooks/HTMLFileCache::useFileCache
diff --git a/includes/skins/SkinMinervaBeta.php
b/includes/skins/SkinMinervaBeta.php
index 5ceddff..17fca98 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -84,9 +84,7 @@
if ( $title->isMainPage() ) {
$styles[] = 'skins.minerva.mainPage.beta.styles';
}
- $styles[] = 'skins.minerva.beta.styles';
$styles[] = 'skins.minerva.content.styles.beta';
- $styles[] = 'skins.minerva.icons.beta.images';
return $styles;
}
diff --git a/resources/skins.minerva.base.styles/pageactions.less
b/resources/skins.minerva.base.styles/pageactions.less
index f5b1a33..610f27a 100644
--- a/resources/skins.minerva.base.styles/pageactions.less
+++ b/resources/skins.minerva.base.styles/pageactions.less
@@ -95,3 +95,65 @@
}
}
}
+
+.new-action-bar {
+ .heading-holder {
+ @pageActionsHeight: @pageActionFontSize + (2 *
@iconGutterWidth);
+
+ overflow: hidden;
+ position: relative;
+ padding-bottom: @pageActionsHeight;
+ }
+
+ #page-actions {
+ position: absolute;
+ float: none;
+ bottom: 0;
+ width: 100%;
+
+ border-top: 1px solid @colorGray14;
+ border-bottom: 1px solid @colorGray12;
+
+ padding: 0.5em 0;
+
+ li {
+ display: inline-block;
+ margin-bottom: 0;
+ float: right;
+
+ &:first-child {
+ margin-top: 0;
+ }
+ }
+
+ .language-selector {
+ float: left;
+ margin-left: -@iconGutterWidth;
+
+ &.disabled {
+ cursor: default;
+ opacity: 0.25;
+ }
+ }
+
+ #ca-edit {
+ margin-right: -@iconGutterWidth;
+ }
+ }
+}
+
+@media all and ( min-width: @deviceWidthTablet ) {
+ .new-action-bar {
+ #page-actions {
+ position: initial;
+ float: right;
+ width: auto;
+ border: 0;
+ margin: 0 0 @iconGutterWidth @iconGutterWidth;
+ }
+
+ .language-selector {
+ float: none;
+ }
+ }
+}
diff --git a/resources/skins.minerva.beta.styles/pageactions.less
b/resources/skins.minerva.beta.styles/pageactions.less
deleted file mode 100644
index 01f03ce..0000000
--- a/resources/skins.minerva.beta.styles/pageactions.less
+++ /dev/null
@@ -1,59 +0,0 @@
-@import 'minerva.variables';
-
-.heading-holder {
- @pageActionsHeight: @pageActionFontSize + (2 * @iconGutterWidth);
-
- overflow: hidden;
- position: relative;
- padding-bottom: @pageActionsHeight;
-}
-
-#page-actions {
- position: absolute;
- float: none;
- bottom: 0;
- width: 100%;
-
- border-top: 1px solid @colorGray14;
- border-bottom: 1px solid @colorGray12;
-
- padding: 0.5em 0;
-
- li {
- display: inline-block;
- margin-bottom: 0;
- float: right;
-
- &:first-child {
- margin-top: 0;
- }
- }
-
- .language-selector {
- float: left;
- margin-left: -@iconGutterWidth;
-
- &.disabled {
- cursor: default;
- opacity: 0.25;
- }
- }
-
- #ca-edit {
- margin-right: -@iconGutterWidth;
- }
-}
-
-@media all and ( min-width: @deviceWidthTablet ) {
- #page-actions {
- position: initial;
- float: right;
- width: auto;
- border: 0;
- margin: 0 0 @iconGutterWidth @iconGutterWidth;
- }
-
- .language-selector {
- float: none;
- }
-}
diff --git a/resources/skins.minerva.icons.beta.images/languageSwitcher.svg
b/resources/skins.minerva.icons.images/languageSwitcher.svg
similarity index 100%
rename from resources/skins.minerva.icons.beta.images/languageSwitcher.svg
rename to resources/skins.minerva.icons.images/languageSwitcher.svg
--
To view, visit https://gerrit.wikimedia.org/r/301352
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f4ddf9ec313605c90ff76d22bf0eeaaad6ba7d8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits