Bmansurov has uploaded a new change for review.
https://gerrit.wikimedia.org/r/322967
Change subject: Feature flag categories
......................................................................
Feature flag categories
The feature is enabled in the beta mode as before.
Bug: T148195
Change-Id: I8abfd39821743877ec4b834673297bf5330e8d1b
---
M extension.json
M includes/skins/MinervaTemplateBeta.php
M includes/skins/SkinMinerva.php
M includes/skins/SkinMinervaBeta.php
4 files changed, 39 insertions(+), 50 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/67/322967/1
diff --git a/extension.json b/extension.json
index ab6658a..0a2a274 100644
--- a/extension.json
+++ b/extension.json
@@ -2030,6 +2030,10 @@
"beta": true,
"base": true
},
+ "MinervaShowCategoriesButton": {
+ "base": false,
+ "beta": true
+ },
"MFStripResponsiveImages": true,
"MFResponsiveImageWhitelist": [
"image/svg+xml"
diff --git a/includes/skins/MinervaTemplateBeta.php
b/includes/skins/MinervaTemplateBeta.php
index 5b32b76..d87322c 100644
--- a/includes/skins/MinervaTemplateBeta.php
+++ b/includes/skins/MinervaTemplateBeta.php
@@ -8,41 +8,4 @@
* beta mode via Special:MobileOptions
*/
class MinervaTemplateBeta extends MinervaTemplate {
- /**
- * Get category button if categories are present
- * @return array A map of the button's friendly name, "categories" to
its
- * spec if the button can be displayed.
- */
- protected function getCategoryButton() {
- $skin = $this->getSkin();
- $categories = $skin->getCategoryLinks( false /* don't render
the heading */ );
-
- if ( !$categories ) {
- return [];
- }
-
- return [
- 'categories' => [
- 'attributes' => [
- 'href' => '#/categories',
- // add hidden class (the overlay works
only, when JS is enabled (class will
- // be removed in categories/init.js)
- 'class' => 'category-button hidden',
- ],
- 'label' => $this->getMsg( 'categories' )->text()
- ],
- ];
- }
-
- /**
- * Get page secondary actions
- *
- * @return array An array of button definitions
- */
- protected function getSecondaryActions() {
- $result = parent::getSecondaryActions();
- $result += $this->getCategoryButton();
-
- return $result;
- }
}
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 24b8c4a..e3f19ca 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -29,6 +29,9 @@
/** @var bool Whether the page is also available in other languages or
variants */
protected $doesPageHaveLanguages = false;
+ /** @var bool Whether to show the categories button on the page */
+ protected $shouldShowCategoriesButton = false;
+
/**
* Wrapper for MobileContext::getMFConfig()
@@ -285,6 +288,7 @@
$this->isUserPage = true;
}
}
+ $this->shouldShowCategoriesButton =
$this->mobileContext->getConfigVariable( 'MinervaShowCategoriesButton' );
}
/**
@@ -933,6 +937,29 @@
}
/**
+ * Get category button if categories are present
+ * @return array A map of the button's friendly name, "categories" to
its
+ * spec if the button can be displayed.
+ */
+ protected function getCategoryButton() {
+ $categories = $this->getCategoryLinks();
+
+ if ( !$categories ) {
+ return [];
+ }
+
+ return [
+ 'attributes' => [
+ 'href' => '#/categories',
+ // add hidden class (the overlay works only,
when JS is enabled (class will
+ // be removed in categories/init.js)
+ 'class' => 'category-button hidden',
+ ],
+ 'label' => $this->msg( 'categories' )->text()
+ ];
+ }
+
+ /**
* Returns an array of links for page secondary actions
* @param BaseTemplate $tpl
* @return string[]
@@ -958,6 +985,10 @@
if ( $this->doesPageHaveLanguages && $title->isMainPage() ) {
$buttons['language'] = $this->getLanguageButton();
+ }
+
+ if ( $this->shouldShowCategoriesButton ) {
+ $buttons['categories'] = $this->getCategoryButton();
}
return $buttons;
@@ -1230,6 +1261,10 @@
$modules[] = 'skins.minerva.talk';
}
+ if ( $this->shouldShowCategoriesButton ) {
+ $modules[] = 'skins.minerva.categories';
+ }
+
return $modules;
}
diff --git a/includes/skins/SkinMinervaBeta.php
b/includes/skins/SkinMinervaBeta.php
index 1782962..c35d88e 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -14,19 +14,6 @@
protected $mode = 'beta';
/**
- * Returns an array of modules related to the current context of the
page.
- * @return array
- */
- public function getContextSpecificModules() {
- $modules = parent::getContextSpecificModules();
- if ( $this->getCategoryLinks( false ) ) {
- $modules[] = 'skins.minerva.categories';
- }
-
- return $modules;
- }
-
- /**
* Returns the javascript modules to load.
* @return array
*/
--
To view, visit https://gerrit.wikimedia.org/r/322967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8abfd39821743877ec4b834673297bf5330e8d1b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits