Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/63002
Change subject: Story 578: Allow photo uploads on pages with infoboxes
......................................................................
Story 578: Allow photo uploads on pages with infoboxes
Allow site to configure when to show photo uploader
This allows us to turn off the feature and tweak it easily
Follow advice in bug 44133 and add variable to startup module
Change-Id: I08f91aa6b960d642802463424f83c93f6387f0d1
---
M MobileFrontend.php
M includes/skins/SkinMinerva.php
M javascripts/modules/mf-photo.js
M tests/javascripts/modules/test_mf-photo.js
4 files changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/02/63002/1
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 520ab68..2d62f9b 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -943,3 +943,9 @@
* Whether or not anonymous (not logged in) users should be able to edit.
*/
$wgMFAnonymousEditing = false;
+
+/**
+ * A css selector which is used to test whether to prompt the user photo
uploads on
+ * the current page. Set to '*' to turn off lead photo uploads altogether
+ */
+$wgMFLeadPhotoUploadCssSelector = 'img, .navbox';
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 3b7239f..04bf2a9 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -21,6 +21,14 @@
'mobile.stable.universal',
);
$out->addModules( $modules );
+ $out->addJsConfigVars( $this->getConfigVariables() );
+ }
+
+ public function getConfigVariables() {
+ global $wgMFLeadPhotoUploadCssSelector;
+ return array(
+ 'wgMFLeadPhotoUploadCssSelector' =>
$wgMFLeadPhotoUploadCssSelector,
+ );
}
/**
diff --git a/javascripts/modules/mf-photo.js b/javascripts/modules/mf-photo.js
index 361eb47..7bbff1b 100644
--- a/javascripts/modules/mf-photo.js
+++ b/javascripts/modules/mf-photo.js
@@ -31,7 +31,7 @@
$container = $content_0;
}
- return $container.find( 'img, .navbox, .infobox' ).length === 0;
+ return $container.find( mw.config.get(
'wgMFLeadPhotoUploadCssSelector' ) ).length === 0;
}
function isSupported() {
diff --git a/tests/javascripts/modules/test_mf-photo.js
b/tests/javascripts/modules/test_mf-photo.js
index afbc220..433bd48 100644
--- a/tests/javascripts/modules/test_mf-photo.js
+++ b/tests/javascripts/modules/test_mf-photo.js
@@ -1,6 +1,7 @@
( function ( $, M ) {
var photo = M.require( 'photo' ),
+ _wgMFLeadPhotoUploadCssSelector,
articles = [
// blank #content_0
[ $( '<div><div id="content_0"></div></div>' ), true ],
@@ -28,9 +29,12 @@
QUnit.module( 'MobileFrontend photo', {
setup: function() {
+ _wgMFLeadPhotoUploadCssSelector = mw.config.get(
'wgMFLeadPhotoUploadCssSelector' );
+ mw.config.set( 'wgMFLeadPhotoUploadCssSelector', 'img, .navbox,
.infobox' );
this.clock = sinon.useFakeTimers();
},
tearDown: function () {
+ mw.config.set( 'wgMFLeadPhotoUploadCssSelector',
_wgMFLeadPhotoUploadCssSelector );
this.clock.restore();
}
} );
--
To view, visit https://gerrit.wikimedia.org/r/63002
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I08f91aa6b960d642802463424f83c93f6387f0d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits