[MediaWiki-commits] [Gerrit] Final tweaks to QuickSurvey panel placement. - change (mediawiki...QuickSurveys)

2015-09-24 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240921

Change subject: Final tweaks to QuickSurvey panel placement.
..

Final tweaks to QuickSurvey panel placement.

* On mobile, places panel after the first p element with content
* On desktop, places panel before first infobox, thumb, or heading
* Otherwise, places panel at the end of the article

Bug: T113651
Change-Id: Iad47e72ff5eaae82ec51546255d8c6ba274fad8e
---
M resources/ext.quicksurveys.init/init.js
1 file changed, 19 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/21/240921/1

diff --git a/resources/ext.quicksurveys.init/init.js 
b/resources/ext.quicksurveys.init/init.js
index 08d2bc8..cf1adbc 100644
--- a/resources/ext.quicksurveys.init/init.js
+++ b/resources/ext.quicksurveys.init/init.js
@@ -26,20 +26,31 @@
 
/**
 * Insert the quick survey panel into the article either (in priority 
order)
-* before the first instance of a thumbnail,
-* before the first instance of a heading
-* or at the end of the article when no headings nor thumbnails exist
+* On mobile: after the first p element with content
+* On desktop: before the first instance of a infobox, thumb, or heading
+* Or after the article when no infobox, thumbnails or headings exist
+*
 * @param {jQuery.Object} $panel
 */
function insertPanel( $panel ) {
var $bodyContent = $( '.mw-content-ltr, .mw-content-rtl' ),
-   $place = $bodyContent
-   .find( '.infobox, > .thumb, > h1, > h2, > h3, > 
h4, > h5, > h6' )
-   .eq( 0 );
+   $place;
 
-   if ( $place.length ) {
-   $panel.insertBefore( $place );
+   if ( window.innerWidth <= 768 ) {
+   $bodyContent.find( '> div > p' ).each( function() {
+   if ( $.trim( $( this ).text() ).length > 0 ) {
+   $panel.insertAfter( $( this ) );
+   return false;
+   }
+   } );
} else {
+   $panel.insertBefore( $bodyContent
+   .find( '.infobox, .thumb, > h1, > h2, > h3, > 
h4, > h5, > h6' )
+   .eq( 0 )
+   );
+   }
+
+   if ( $panel.length === 0 ) {
$panel.appendTo( $bodyContent );
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/240921
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad47e72ff5eaae82ec51546255d8c6ba274fad8e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Init QuickSurveys only on existing pages in the main namespace - change (mediawiki...QuickSurveys)

2015-09-24 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240905

Change subject: Init QuickSurveys only on existing pages in the main namespace
..

Init QuickSurveys only on existing pages in the main namespace

Bug: T113652
Change-Id: I3af29f39ce0b832999e70746e80163238d3a9f5f
---
M includes/QuickSurveys.hooks.php
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/05/240905/1

diff --git a/includes/QuickSurveys.hooks.php b/includes/QuickSurveys.hooks.php
index e009635..63d1c6a 100644
--- a/includes/QuickSurveys.hooks.php
+++ b/includes/QuickSurveys.hooks.php
@@ -29,7 +29,8 @@
}
 
/**
-* BeforePageDisplay hook handler
+* Init QuickSurveys in BeforePageDisplay hook on existing pages in the 
main namespace
+*
 * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
 *
 * @param OutputPage $out
@@ -37,7 +38,10 @@
 * @return bool
 */
public static function onBeforePageDisplay( &$out, &$sk ) {
-   $out->addModules( 'ext.quicksurveys.init' );
+   $title = $out->getTitle();
+   if ( $title->inNamespace( NS_MAIN ) && $title->exists() ) {
+   $out->addModules( 'ext.quicksurveys.init' );
+   }
return true;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/240905
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3af29f39ce0b832999e70746e80163238d3a9f5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Security improvements - change (mediawiki...QuickSurveys)

2015-09-21 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/239993

Change subject: Security improvements
..

Security improvements

* Parse messages used directly in HTML in ExternalSurvey.js
* Truncate Country code to 2 characters per ISO_3166-1 alpha-2

Bug: T110662
Change-Id: I742221107e5becc784b2721b4df070d8cccbffe9
---
M resources/ext.quicksurveys.views/ExternalSurvey.js
M resources/ext.quicksurveys.views/utils.js
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/93/239993/1

diff --git a/resources/ext.quicksurveys.views/ExternalSurvey.js 
b/resources/ext.quicksurveys.views/ExternalSurvey.js
index 82ab5db..5694064 100644
--- a/resources/ext.quicksurveys.views/ExternalSurvey.js
+++ b/resources/ext.quicksurveys.views/ExternalSurvey.js
@@ -15,7 +15,7 @@
 * @inheritdoc
 */
initialize: function ( config ) {
-   this.defaults.templateData.footer = mw.msg( 
config.survey.privacyPolicy );
+   this.defaults.templateData.footer = mw.message( 
config.survey.privacyPolicy ).parse();
QuickSurvey.prototype.initialize.call( this, config );
},
/**
@@ -23,9 +23,11 @@
 */
renderButtons: function () {
var $btnContainer = this.initialPanel.$element.find( 
'.survey-button-container' ),
+   // Force https per security review See: T110662
+   link = mw.msg( this.config.survey.link 
).replace( 'http:', 'https:' ),
buttons = [
{
-   href: mw.msg( 
this.config.survey.link ),
+   href: link,
target: '_blank',
label: mw.msg( 
'ext-quicksurveys-external-survey-yes-button' ),
flags: 'constructive'
diff --git a/resources/ext.quicksurveys.views/utils.js 
b/resources/ext.quicksurveys.views/utils.js
index fd0b727..b69d19f 100644
--- a/resources/ext.quicksurveys.views/utils.js
+++ b/resources/ext.quicksurveys.views/utils.js
@@ -53,7 +53,8 @@
var geoIP = mw.cookie.get( 'GeoIP', '' );
 
if ( geoIP ) {
-   return geoIP.split( ':' )[0];
+   // Return truncated per ISO 3166-1 alpha-2 country code
+   return geoIP.split( ':' )[0].substring( 0, 2 );
}
return 'Unknown';
}

-- 
To view, visit https://gerrit.wikimedia.org/r/239993
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I742221107e5becc784b2721b4df070d8cccbffe9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove mobile.experiments as mediawiki.experiments is in core - change (mediawiki...MobileFrontend)

2015-09-10 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237501

Change subject: Remove mobile.experiments as mediawiki.experiments is in core
..

Remove mobile.experiments as mediawiki.experiments is in core

Bug: T111287
Change-Id: I2cd0d95632be884db5cafd6d5b789e55c95c4609
---
M includes/Config.php
M includes/MobileFrontend.hooks.php
M includes/Resources.php
D includes/config/Experiments.php
M includes/skins/SkinMinerva.php
D resources/mobile.experiments/experiments.js
D tests/qunit/mobile.experiments/test_experiments.js
7 files changed, 0 insertions(+), 238 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/01/237501/1

diff --git a/includes/Config.php b/includes/Config.php
index 6c13fc9..64442c9 100644
--- a/includes/Config.php
+++ b/includes/Config.php
@@ -3,7 +3,6 @@
require_once __DIR__ . "/config/Analytics.php";
require_once __DIR__ . "/config/Editing.php";
require_once __DIR__ . "/config/Experimental.php";
-   require_once __DIR__ . "/config/Experiments.php";
require_once __DIR__ . "/config/Legacy.php";
require_once __DIR__ . "/config/Nearby.php";
require_once __DIR__ . "/config/Site.php";
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index a2ec58d..ed8b861 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -348,7 +348,6 @@
// Get the licensing agreement that is displayed in the 
uploading interface.
$wgMFUploadLicense = SkinMinerva::getLicense( 'upload' );
$vars += array(
-   'wgMFExperiments' => $config->get( 'MFExperiments' ),
'wgMFNearbyEndpoint' => $config->get( 
'MFNearbyEndpoint' ),
'wgMFThumbnailSizes' => array(
'tiny' =>  MobilePage::TINY_IMAGE_WIDTH,
diff --git a/includes/Resources.php b/includes/Resources.php
index 08f493e..3861be0 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -1769,14 +1769,6 @@
'mobile.toc',
),
),
-   'mobile.experiments' => $wgMFResourceFileModuleBoilerplate + array(
-   'dependencies' => array(
-   'mobile.user',
-   ),
-   'scripts' => array(
-   'resources/mobile.experiments/experiments.js',
-   ),
-   ),
 );
 
 $wgResourceModules = array_merge( $wgResourceModules,
diff --git a/includes/config/Experiments.php b/includes/config/Experiments.php
deleted file mode 100644
index 6f9c520..000
--- a/includes/config/Experiments.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
- * $wgMFExperiments = array(
- * 'wikigrok' => array(
- * 'enabled' => true,
- * 'buckets' => array(
- * 'control' => 0.33,
- * 'A' => 0.33,
- * 'B' => 0.33,
- * ),
- * ),
- * );
- * 
- *
- * The wikigrok experiment has three buckets: control, A, and B. The user has 
a 33% chance of being
- * being assigned to each bucket. Note well that if the experiment were 
disabled, then the user is
- * always assigned to the control bucket.
- */
-$wgMFExperiments = array();
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 5931cc3..97d9230 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -1023,12 +1023,6 @@
$modules[] = 'mobile.newusers';
}
}
-
-   $mfExperiments = $this->getMFConfig()->get( 
'MFExperiments' );
-
-   if ( count( $mfExperiments ) > 0 ) {
-   $modules[] = 'mobile.experiments';
-   }
}
 
// TalkOverlay feature
diff --git a/resources/mobile.experiments/experiments.js 
b/resources/mobile.experiments/experiments.js
deleted file mode 100644
index b0cde2f..000
--- a/resources/mobile.experiments/experiments.js
+++ /dev/null
@@ -1,136 +0,0 @@
-( function ( M ) {
-
-   var CONTROL_BUCKET = 'control',
-   user = M.require( 'user' ),
-   MAX_INT32_UNSIGNED = 4294967295;
-
-   /**
-* An implementation of Jenkins's one-at-a-time hash
-* See 
-*
-* @param {String} key String to hash.
-* @return {Number} 32-bit integer.
-* @ignore
-*
-* @author Ori Livneh 
-* @see http://jsbin.com/kejewi/4/watch?js,console
-*/
-   function hashString( key ) {
-   var hash = 0,
-   i = key.length;
-
-   while ( i-- ) {
-   hash += key.charCodeAt( i );
-   hash

[MediaWiki-commits] [Gerrit] Remove mobile.experiments dependency - change (mediawiki...Gather)

2015-09-10 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237500

Change subject: Remove mobile.experiments dependency
..

Remove mobile.experiments dependency

Rationale:
- Removed mobile.experiments from mobile frontend in favor of
mediawiki.experiments
- Removed bucketing work in init.js as no experiment is currently
defined

Bug: 1628014
Change-Id: I83f4eec2691d40b56db28dd69d8453109d86ae31
---
M extension.json
M resources/ext.gather.init/init.js
2 files changed, 1 insertion(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/00/237500/1

diff --git a/extension.json b/extension.json
index a2d069c..28eec93 100644
--- a/extension.json
+++ b/extension.json
@@ -388,7 +388,6 @@
],
"dependencies": [
"ext.gather.menu.icon",
-   "mobile.experiments",
"mobile.watchstar",
"ext.gather.watchstar"
],
diff --git a/resources/ext.gather.init/init.js 
b/resources/ext.gather.init/init.js
index ad04728..c55d6a1 100644
--- a/resources/ext.gather.init/init.js
+++ b/resources/ext.gather.init/init.js
@@ -2,7 +2,6 @@
 ( function ( M, $ ) {
 
var $star, watchstar, pageActionPointer, actionOverlay,
-   bucket, useGatherStar,
CollectionsWatchstar = M.require( 
'ext.gather.watchstar/CollectionsWatchstar' ),
Watchstar = M.require( 'mobile.watchstar/Watchstar' ),
PageActionOverlay = M.require( 
'mobile.contentOverlays/PointerOverlay' ),
@@ -12,8 +11,8 @@
settingOverlayWasDismissed = 'gather-has-dismissed-tutorial',
mainMenuPointerDismissed = 'gather-has-dismissed-mainmenu',
user = M.require( 'user' ),
-   experiments = M.require( 'experiments' ),
context = M.require( 'context' ),
+   useGatherStar = context.isBetaGroupMember(),
skin = M.require( 'skin' ),
mainMenu = M.require( 'mainMenu' ),
Page = M.require( 'Page' ),
@@ -167,14 +166,6 @@
}
}
} );
-   }
-
-   try {
-   bucket = experiments.getBucket( 'gather' );
-   useGatherStar = context.isBetaGroupMember() || bucket === 'A';
-   } catch ( e ) {
-   // experiment hasn't been defined. Only enable in beta.
-   useGatherStar = context.isBetaGroupMember();
}
 
// Only init when current page is an article

-- 
To view, visit https://gerrit.wikimedia.org/r/237500
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83f4eec2691d40b56db28dd69d8453109d86ae31
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use the correct schema for example survey - change (mediawiki...QuickSurveys)

2015-09-09 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237173

Change subject: Use the correct schema for example survey
..

Use the correct schema for example survey

Change-Id: I2ff8c69d8b9eb3da1e085c84b69ecd711ffa02e7
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/73/237173/1

diff --git a/extension.json b/extension.json
index 1869db7..aca5100 100644
--- a/extension.json
+++ b/extension.json
@@ -125,7 +125,7 @@
"negative": 
"ext-quicksurveys-example-internal-survey-answer-negative"
},
"@schema": "Which schema to log to",
-   "schema": "QuickSurveysResponse",
+   "schema": "QuickSurveysResponses",
"@enabled": "whether the survey is enabled",
"enabled": false,
"@coverage": "percentage of users that will see 
the survey",

-- 
To view, visit https://gerrit.wikimedia.org/r/237173
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ff8c69d8b9eb3da1e085c84b69ecd711ffa02e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix typo with example survey schema config - change (operations/mediawiki-config)

2015-09-09 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237145

Change subject: Fix typo with example survey schema config
..

Fix typo with example survey schema config

Bug: T111974
Change-Id: I49cf1006dcd2e0c26b3b96adeea889c31ecf05c8
---
M wmf-config/CommonSettings-labs.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/45/237145/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index 7739efd..f4445a5 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -242,7 +242,7 @@
'neutral' => 
'ext-quicksurveys-example-internal-survey-answer-neutral',
'negative' => 
'ext-quicksurveys-example-internal-survey-answer-negative',
),
-   'schema' => 'QuickSurveysResponses',
+   'schema' => 'QuickSurveysResponse',
'enabled' => true,
'coverage' => .5,
'description' => 
'ext-quicksurveys-example-internal-survey-description',

-- 
To view, visit https://gerrit.wikimedia.org/r/237145
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49cf1006dcd2e0c26b3b96adeea889c31ecf05c8
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Switch dev back to the default branch - change (mediawiki...QuickSurveys)

2015-09-08 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236986

Change subject: Switch dev back to the default branch
..

Switch dev back to the default branch

Change-Id: I85499908ac9e97c035d5b5e276031b233163
---
M .gitreview
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/86/236986/1

diff --git a/.gitreview b/.gitreview
index 93cc955..a7671ae 100644
--- a/.gitreview
+++ b/.gitreview
@@ -2,5 +2,5 @@
 host=gerrit.wikimedia.org
 port=29418
 project=mediawiki/extensions/QuickSurveys.git
-defaultbranch=master
+defaultbranch=dev
 defaultrebase=0

-- 
To view, visit https://gerrit.wikimedia.org/r/236986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85499908ac9e97c035d5b5e276031b233163
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Enable QuickSurveys by default on labs with example survey - change (operations/mediawiki-config)

2015-09-08 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236979

Change subject: Enable QuickSurveys by default on labs with example survey
..

Enable QuickSurveys by default on labs with example survey

Bug: T110199
Change-Id: I318d31e190e8c972ac384ce5b6d949dcdbe4442f
---
M wmf-config/CommonSettings-labs.php
M wmf-config/InitialiseSettings-labs.php
2 files changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/79/236979/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index e7bbdeb..c661ea8 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -230,6 +230,29 @@
);
 }
 
+if ( $wmgUseQuickSurveys ) {
+   wfLoadExtensions( array( 'QuickSurveys' ) );
+
+   $wgQuickSurveysConfig[] = array(
+   "name" => "internal example survey",
+   "type" => "internal",
+   "question" => 
"ext-quicksurveys-example-internal-survey-question",
+   "answers" => array(
+   "positive" => 
"ext-quicksurveys-example-internal-survey-answer-positive",
+   "neutral" => 
"ext-quicksurveys-example-internal-survey-answer-neutral",
+   "negative"=> 
"ext-quicksurveys-example-internal-survey-answer-negative"
+   ),
+   "schema" => "QuickSurveysResponses",
+   "enabled" => true,
+   "coverage" => .5,
+   "description" => 
"ext-quicksurveys-example-internal-survey-description",
+   "platform" => array(
+   "desktop" => array( "stable" ),
+   "mobile" => array( "stable", "beta", "alpha" ),
+   ),
+   );
+}
+
 if ( $wmgUseSentry ) {
require_once( "$IP/extensions/Sentry/Sentry.php" );
$wgSentryDsn = $wmgSentryDsn;
diff --git a/wmf-config/InitialiseSettings-labs.php 
b/wmf-config/InitialiseSettings-labs.php
index 978f2d5..88fecc4 100644
--- a/wmf-config/InitialiseSettings-labs.php
+++ b/wmf-config/InitialiseSettings-labs.php
@@ -986,6 +986,10 @@
'metawiki' => true,
),
 
+   'wmgUseQuickSurveys' = array(
+   'default' => true,
+   ),
+
'wmgUseSentry' => array(
'default' => true,
),

-- 
To view, visit https://gerrit.wikimedia.org/r/236979
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I318d31e190e8c972ac384ce5b6d949dcdbe4442f
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Release 0.1.0 of QuickSurveys - change (mediawiki...QuickSurveys)

2015-09-08 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236972

Change subject: Release 0.1.0 of QuickSurveys
..

Release 0.1.0 of QuickSurveys

Merge branch 'dev'
Generated via
``git merge --no-ff origin/dev``

Change-Id: Idc6af61a633a125dc0a149ca411e646984acbf90
---
M .gitreview
M extension.json
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/72/236972/1

diff --git a/.gitreview b/.gitreview
index a7671ae..93cc955 100644
--- a/.gitreview
+++ b/.gitreview
@@ -2,5 +2,5 @@
 host=gerrit.wikimedia.org
 port=29418
 project=mediawiki/extensions/QuickSurveys.git
-defaultbranch=dev
+defaultbranch=master
 defaultrebase=0
diff --git a/extension.json b/extension.json
index 1869db7..1e96013 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "QuickSurveys",
-   "version": "0.0.1",
+   "version": "0.1.0",
"author": [
"Bahodir Mansurov",
"Joaquin Hernandez",

-- 
To view, visit https://gerrit.wikimedia.org/r/236972
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc6af61a633a125dc0a149ca411e646984acbf90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Push max-width work from beta to stable - change (mediawiki...MobileFrontend)

2015-09-04 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236226

Change subject: Push max-width work from beta to stable
..

Push max-width work from beta to stable

And eliminated empty modules

Bug: T101344
Change-Id: If6ac8bcad40cbf409fe777da6c75db09c7e29775
---
M includes/Resources.php
M includes/skins/SkinMinervaBeta.php
M resources/mobile.contentOverlays/tutorials.less
M resources/mobile.overlays/Overlay.less
D resources/skins.minerva.beta.styles/main.less
M resources/skins.minerva.content.styles/main.less
D resources/skins.minerva.tablet.beta.styles/common.less
D resources/skins.minerva.tablet.beta.styles/hacks.less
D resources/skins.minerva.tablet.beta.styles/ui.less
M resources/skins.minerva.tablet.styles/common.less
M resources/skins.minerva.tablet.styles/hacks.less
11 files changed, 75 insertions(+), 117 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/26/236226/1

diff --git a/includes/Resources.php b/includes/Resources.php
index 3c0b83f..366b386 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -85,14 +85,6 @@
'resources/skins.minerva.tablet.styles/hacks.less',
),
),
-   'skins.minerva.tablet.beta.styles' => 
$wgMFResourceFileModuleBoilerplate + array(
-   'position' => 'top',
-   'styles' => array(
-   'resources/skins.minerva.tablet.beta.styles/ui.less',
-   
'resources/skins.minerva.tablet.beta.styles/common.less',
-   'resources/skins.minerva.tablet.beta.styles/hacks.less',
-   ),
-   ),
'skins.minerva.icons.images' => $wgMFResourceFileModuleBoilerplate + 
array(
'class' => 'ResourceLoaderImageModule',
'prefix' => 'mw-ui',
@@ -197,7 +189,6 @@
'resources/skins.minerva.beta.styles/common.less',
'resources/skins.minerva.beta.styles/pageactions.less',
'resources/skins.minerva.beta.styles/footer.less',
-   'resources/skins.minerva.beta.styles/main.less',
),
),
'skins.minerva.beta.images' => $wgMFResourceFileModuleBoilerplate + 
array(
diff --git a/includes/skins/SkinMinervaBeta.php 
b/includes/skins/SkinMinervaBeta.php
index c75982f..c0d6701 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -126,7 +126,6 @@
protected function getSkinStyles() {
$styles = parent::getSkinStyles();
$styles[] = 'skins.minerva.beta.styles';
-   $styles[] = 'skins.minerva.tablet.beta.styles';
$styles[] = 'skins.minerva.beta.images';
if ( $this->getTitle()->isMainPage() ) {
$styles[] = 'skins.minerva.mainPage.beta.styles';
diff --git a/resources/mobile.contentOverlays/tutorials.less 
b/resources/mobile.contentOverlays/tutorials.less
index 82d8335..7aa1452 100644
--- a/resources/mobile.contentOverlays/tutorials.less
+++ b/resources/mobile.contentOverlays/tutorials.less
@@ -1,6 +1,16 @@
 @import "minerva.variables";
 @import "minerva.mixins";
 
+
+@media all and (min-width: @wgMFDeviceWidthTablet) {
+   // Take into account padding in width of pointer overlay so that it
+   // can point to anything in the containing content area and avoid
+   // padding issues such as https://phabricator.wikimedia.org/F287611
+   #mw-mf-page-center .pointer-overlay {
+   max-width: @wgMFDeviceWidthDesktop;
+   }
+}
+
 .navigation-drawer {
.pointer-overlay {
right: auto;
diff --git a/resources/mobile.overlays/Overlay.less 
b/resources/mobile.overlays/Overlay.less
index c514afb..ad105d3 100644
--- a/resources/mobile.overlays/Overlay.less
+++ b/resources/mobile.overlays/Overlay.less
@@ -374,18 +374,15 @@
}
}
 
-   .alpha,
-   .beta {
-   .overlay-header {
-   .cancel {
-   // so that the icon image is aligned with the 
content
-   left: -@iconGutterWidth;
-   }
-   // Search input in the header
-   input.search {
-   // because we're pulling .main-menu-button to 
the left too (see above)
-   margin-left: -@iconGutterWidth;
-   }
+   .overlay-header {
+   .cancel {
+   // so that the icon image is aligned with the content
+   left: -@iconGutterWidth;
+   }
+   // Search input in the header
+   input.search {
+   // because we're pulling .main-menu-button to the left 
too (see above)
+   

[MediaWiki-commits] [Gerrit] Remove history-link-loaded event and inline script wrapper - change (mediawiki...MobileFrontend)

2015-09-04 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236191

Change subject: Remove history-link-loaded event and inline script wrapper
..

Remove history-link-loaded event and inline script wrapper

History link modifications are now done slightly slower than before.
But I suppose this is acceptable now that the last-modified is at the
bottome of the page

Change-Id: Ia4e04f749223d7bf5d222687fe02cbfe98181d41
---
M includes/skins/MinervaTemplate.php
M resources/mobile.head/init.js
2 files changed, 7 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/91/236191/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 7abee82..e315b6d 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -288,29 +288,18 @@
 * @param array $data Data used to build the page
 */
protected function renderContentWrapper( $data ) {
-   echo $this->makeInlineMobileHeadEmitScript( 'header-loaded' );
+   // Construct an inline script which emits header-loaded
+   $headerLoaded = "mw.loader.using( 'mobile.head', function () {";
+   $headerLoaded .= "mw.mobileFrontend.emit( 'header-loaded' );";
+   $headerLoaded .= "} );";
+   echo ResourceLoader::makeInlineScript( $headerLoaded );
+
$this->renderPreContent( $data );
$this->renderContent( $data );
// Last modified bar at the top of the article
if ( !$this->isMainPage ) {
echo $this->getHistoryLinkHtml( $data );
}
-   echo $this->makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
-   }
-
-   /**
-* Construct an inline script tag which emits the given event
-*
-* The emit code will be wrapped in a closure using the mobile.head 
module
-*
-* @param string $event Event to emit
-* @return WrappedString HTML
-*/
-   protected function makeInlineMobileHeadEmitScript( $event ) {
-   $script = "mw.loader.using( 'mobile.head', function () {";
-   $script .= "mw.mobileFrontend.emit( '" . $event . "' );";
-   $script .= "} );";
-   return ResourceLoader::makeInlineScript( $script );
}
 
/**
diff --git a/resources/mobile.head/init.js b/resources/mobile.head/init.js
index 415682e..71844dc 100644
--- a/resources/mobile.head/init.js
+++ b/resources/mobile.head/init.js
@@ -35,7 +35,6 @@
 
// bind events
M.define( 'mainMenu', mainMenu );
-   M.on( 'history-link-loaded', initHistoryLink );
M.on( 'header-loaded', function () {
// Now we have a main menu button register it.
mainMenu.registerClickEvents();
@@ -45,6 +44,7 @@
if ( !$( '#mw-mf-page-left' ).find( '.menu' ).length ) {
mainMenu.appendTo( '#mw-mf-page-left' );
}
+   initHistoryLink();
} );
 
 }( mw.mobileFrontend, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/236191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4e04f749223d7bf5d222687fe02cbfe98181d41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Promote beta last-modified-bar work to stable - change (mediawiki...MobileFrontend)

2015-09-03 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/235904

Change subject: Promote beta last-modified-bar work to stable
..

Promote beta last-modified-bar work to stable

- Last modified bar is now on the bottom of the page
- Eliminate no longer needed methods from MinervaTemplate.php
- Remove modified bar location specific classes from template

Note: tablet styles for .last-modified-bar.pre-content to be
removed when cache clears.

Bug: T104697
Change-Id: I2e2259f381e42944106b9b2972fd83b37acd1ead
---
M includes/skins/MinervaTemplate.php
M includes/skins/MinervaTemplateBeta.php
M includes/skins/history.mustache
M resources/skins.minerva.content.styles/links.less
M resources/skins.minerva.tablet.beta.styles/ui.less
M resources/skins.minerva.tablet.styles/common.less
6 files changed, 38 insertions(+), 71 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/04/235904/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index fdf2112..7abee82 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -7,9 +7,6 @@
  * Extended Template class of BaseTemplate for mobile devices
  */
 class MinervaTemplate extends BaseTemplate {
-   /** @var boolean Temporary variable that decides whether
-* history link should be rendered before the content. */
-   protected $renderHistoryLinkBeforeContent = true;
/** @var string $searchPlaceHolderMsg Message used as placeholder in 
search input */
protected $searchPlaceHolderMsg = 'mobile-frontend-placeholder';
 
@@ -168,32 +165,6 @@
}
 
/**
-* Gets history link at top of page if it isn't the main page
-* @param array $data Data used to build the page
-* @return string
-*/
-   protected function getHistoryLinkTopHtml( $data ) {
-   if ( !$this->isMainPage ) {
-   return $this->getHistoryLinkHtml( $data );
-   } else {
-   return '';
-   }
-   }
-
-   /**
-* Gets history link at bottom of page if it is the main page
-* @param array $data Data used to build the page
-* @return string
-*/
-   protected function getHistoryLinkBottomHtml( $data ) {
-   if ( $this->isMainPage ) {
-   return $this->getHistoryLinkHtml( $data );
-   } else {
-   return '';
-   }
-   }
-
-   /**
 * Get page secondary actions
 */
protected function getSecondaryActions() {
@@ -254,15 +225,16 @@
'lang' => $data['pageLang'],
'dir' => $data['pageDir'],
) );
-   ?>
-   getPostContentHtml( $data );
-   echo $this->getSecondaryActionsHtml();
-   echo $this->getHistoryLinkBottomHtml( $data );
+   echo $data[ 'bodytext' ];
+   if ( isset( $data['subject-page'] ) ) {
+   echo $data['subject-page'];
+   }
+   echo $this->getPostContentHtml( $data );
+   echo $this->getSecondaryActionsHtml();
+   // History link on the bottom of the main page
+   if ( $this->isMainPage ) {
+   echo $this->getHistoryLinkHtml( $data );
+   }
?>

renderHistoryLinkBeforeContent ) {
-   echo $this->getHistoryLinkTopHtml( $data );
-   echo $this->makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
-   }
echo $this->makeInlineMobileHeadEmitScript( 'header-loaded' );
$this->renderPreContent( $data );
$this->renderContent( $data );
-   if ( !$this->renderHistoryLinkBeforeContent ) {
-   echo $this->getHistoryLinkTopHtml( $data );
-   echo $this->makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
+   // Last modified bar at the top of the article
+   if ( !$this->isMainPage ) {
+   echo $this->getHistoryLinkHtml( $data );
}
+   echo $this->makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
}
 
/**
diff --git a/includes/skins/MinervaTemplateBeta.php 
b/includes/skins/MinervaTemplateBeta.php
index 1fbf4b0..8e12f81 100644
--- a/includes/skins/MinervaTemplateBeta.php
+++ b/includes/skins/MinervaTemplateBeta.php
@@ -8,8 +8,6 @@
  * beta mode via Special:MobileOptions
  */
 class MinervaTemplateBeta extends

[MediaWiki-commits] [Gerrit] Make edit link and watchstar accessible to ios voiceover - change (mediawiki...MobileFrontend)

2015-08-31 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/235134

Change subject: Make edit link and watchstar accessible to ios voiceover
..

Make edit link and watchstar accessible to ios voiceover

* Give the edit link a element a title attribute
* Make watchstar element a button instead of span

Bug: T87670
Change-Id: Idd36b57e046c7a429aff827aaaf49dbd1f679c20
---
M resources/mobile.editor/init.js
M resources/mobile.watchstar/Watchstar.js
M resources/skins.minerva.base.styles/pageactions.less
3 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/34/235134/1

diff --git a/resources/mobile.editor/init.js b/resources/mobile.editor/init.js
index 3677be2..0034a29 100644
--- a/resources/mobile.editor/init.js
+++ b/resources/mobile.editor/init.js
@@ -44,7 +44,10 @@
 */
function addEditButton( section, container ) {
return $( '' )
-   .attr( 'href', '#/editor/' + section )
+   .attr( {
+   href: '#/editor/' + section,
+   title: $( container ).attr( 'title' )
+   } )
.text( mw.msg( 'mobile-frontend-editor-edit' ) )
.prependTo( container );
}
diff --git a/resources/mobile.watchstar/Watchstar.js 
b/resources/mobile.watchstar/Watchstar.js
index f56875b..789a3a6 100644
--- a/resources/mobile.watchstar/Watchstar.js
+++ b/resources/mobile.watchstar/Watchstar.js
@@ -61,7 +61,7 @@
},
tagName: 'div',
className: watchIcon.getClassName(),
-   template: mw.template.compile( '{{tooltip}}', 
'hogan' ),
+   template: mw.template.compile( '{{tooltip}}', 
'hogan' ),
/** @inheritdoc */
initialize: function ( options ) {
var self = this,
diff --git a/resources/skins.minerva.base.styles/pageactions.less 
b/resources/skins.minerva.base.styles/pageactions.less
index 92298d3..edb8c13 100644
--- a/resources/skins.minerva.base.styles/pageactions.less
+++ b/resources/skins.minerva.base.styles/pageactions.less
@@ -62,7 +62,8 @@
 
input,
a,
-   span {
+   span,
+   button {
// Needed for non-JavaScript users
position: absolute;
display: block;
@@ -72,6 +73,11 @@
margin: 0 0 8px;
}
 
+   button {
+   text-indent: inherit;
+   outline: none;
+   }
+
&:first-child {
margin-top: 3px;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/235134
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd36b57e046c7a429aff827aaaf49dbd1f679c20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Align search placeholder element and input with article heading - change (mediawiki...MobileFrontend)

2015-08-31 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/235061

Change subject: Align search placeholder element and input with article heading
..

Align search placeholder element and input with article heading

bug: T107331
Change-Id: If4fbe7796ccfcb1a8e0342d8f4601ea0b3aeda5f
---
M resources/mobile.overlays/Overlay.less
M resources/skins.minerva.base.styles/ui.less
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/61/235061/1

diff --git a/resources/mobile.overlays/Overlay.less 
b/resources/mobile.overlays/Overlay.less
index c514afb..f9ecc6f 100644
--- a/resources/mobile.overlays/Overlay.less
+++ b/resources/mobile.overlays/Overlay.less
@@ -190,7 +190,7 @@
 
.overlay-title,
.overlay-search {
-   padding: .15em @headerTitlePaddingH 0;
+   padding: .15em @headerTitlePaddingH 0 0;
}
 
.overlay-action {
diff --git a/resources/skins.minerva.base.styles/ui.less 
b/resources/skins.minerva.base.styles/ui.less
index 068f756..86c9456 100644
--- a/resources/skins.minerva.base.styles/ui.less
+++ b/resources/skins.minerva.base.styles/ui.less
@@ -77,7 +77,7 @@
 
// Search
> form {
-   padding: .15em @headerTitlePaddingH 0;
+   padding: .15em @headerTitlePaddingH 0 0;
width: auto;
vertical-align: middle;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/235061
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4fbe7796ccfcb1a8e0342d8f4601ea0b3aeda5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Generate a new token for each survey - change (mediawiki...QuickSurveys)

2015-08-31 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/235050

Change subject: Generate a new token for each survey
..

Generate a new token for each survey

Be consistent about creating tokens.  Otherwise, a user would have
the same token for all existing surveys and different tokens for future
ones.  This ensures that all surveys are seperated rather than grouped.

Change-Id: Ie9fc11ef843e9573bc5ee84bae8a40cca65a128f
---
M resources/ext.quicksurveys.init/init.js
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/50/235050/1

diff --git a/resources/ext.quicksurveys.init/init.js 
b/resources/ext.quicksurveys.init/init.js
index d180eda..dcb5300 100644
--- a/resources/ext.quicksurveys.init/init.js
+++ b/resources/ext.quicksurveys.init/init.js
@@ -3,8 +3,7 @@
$panel = $( '' ),
availableSurveys = mw.config.get( 'wgEnabledQuickSurveys' ),
isMainPage = mw.config.get( 'wgIsMainPage' ),
-   isArticle = mw.config.get( 'wgIsArticle' ),
-   sessionId = mw.user.generateRandomSessionId();
+   isArticle = mw.config.get( 'wgIsArticle' );
 
mw.extQuickSurveys = mw.extQuickSurveys || {};
 
@@ -79,7 +78,8 @@
token = getSurveyToken( survey );
 
if ( !token ) {
-   token = sessionId;
+   // Generate a new token for each survey
+   token = mw.user.generateRandomSessionId();
mw.storage.set( storageId, token );
}
return mw.experiments.getBucket( {

-- 
To view, visit https://gerrit.wikimedia.org/r/235050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9fc11ef843e9573bc5ee84bae8a40cca65a128f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: dev
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Hygiene: Make survey selection easier to read - change (mediawiki...QuickSurveys)

2015-08-28 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/234677

Change subject: Hygiene: Make survey selection easier to read
..

Hygiene: Make survey selection easier to read

Change-Id: I20e0b5f9e0ce9177e4c0c4aa89d5dc67ae7ee92d
---
M resources/ext.quicksurveys.init/init.js
1 file changed, 43 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/77/234677/1

diff --git a/resources/ext.quicksurveys.init/init.js 
b/resources/ext.quicksurveys.init/init.js
index d180eda..4bec70b 100644
--- a/resources/ext.quicksurveys.init/init.js
+++ b/resources/ext.quicksurveys.init/init.js
@@ -1,10 +1,11 @@
 ( function ( $ ) {
var survey, $bodyContent, $place, randomSurvey, surveyIndex,
$panel = $( '' ),
-   availableSurveys = mw.config.get( 'wgEnabledQuickSurveys' ),
+   enabledSurveys = mw.config.get( 'wgEnabledQuickSurveys' ),
isMainPage = mw.config.get( 'wgIsMainPage' ),
isArticle = mw.config.get( 'wgIsArticle' ),
-   sessionId = mw.user.generateRandomSessionId();
+   sessionId = mw.user.generateRandomSessionId(),
+   availableSurveys = [];
 
mw.extQuickSurveys = mw.extQuickSurveys || {};
 
@@ -13,57 +14,52 @@
return;
}
 
+   // Find which surveys are available to the user
+   $( enabledSurveys ).each( function ( i, enabledSurvey ) {
+   // Setting the quicksurvey param makes every enabled survey 
available
+   if ( mw.util.getParamValue( 'quicksurvey' ) ) {
+   availableSurveys.push( enabledSurvey );
+   return;
+   } else if (
+   getSurveyToken( enabledSurvey ) !== '~' &&
+   getBucketForSurvey( enabledSurvey ) === 'A'
+   ) {
+   availableSurveys.push( enabledSurvey );
+   }
+   } );
+
if ( availableSurveys.length ) {
-   // Get a random survey that hasn't been dismissed and in 
correct bucket
-   while ( !survey && availableSurveys.length !== 0 ) {
-   surveyIndex = Math.floor( Math.random() * 
availableSurveys.length );
-   randomSurvey = availableSurveys[surveyIndex];
-   // Setting the param quicksurvey bypasses the bucketing
-   if ( mw.util.getParamValue( 'quicksurvey' ) ) {
-   survey = randomSurvey;
-   break;
-   }
-   if (
-   getSurveyToken( randomSurvey ) === '~' ||
-   getBucketForSurvey( randomSurvey ) !== 'A'
-   ) {
-   availableSurveys.splice( surveyIndex, 1 );
-   continue;
-   }
-   survey = randomSurvey;
+   // Get a random available survey
+   survey = availableSurveys[Math.floor( Math.random() * 
availableSurveys.length )];
+   $bodyContent = $( '.mw-content-ltr, .mw-content-rtl' );
+   $place = $bodyContent.find( '> h1, > h2, > h3, > h4, > h5, > 
h6' ).eq( 0 );
+
+   if ( $place.length ) {
+   $panel.insertBefore( $place );
+   } else {
+   $panel.appendTo( $bodyContent );
}
+   // survey.module contains i18n messages
+   mw.loader.using( [ 'ext.quicksurveys.views', survey.module ] 
).done( function () {
+   var panel,
+   options = {
+   survey: survey,
+   templateData: {
+   question: mw.msg( 
survey.question ),
+   description: mw.msg( 
survey.description )
+   }
+   };
 
-   if ( survey ) {
-   $bodyContent = $( '.mw-content-ltr, .mw-content-rtl' );
-   $place = $bodyContent.find( '> h1, > h2, > h3, > h4, > 
h5, > h6' ).eq( 0 );
-
-   if ( $place.length ) {
-   $panel.insertBefore( $place );
+   if ( survey.type === 'internal' ) {
+   panel = new 
mw.extQuickSurveys.views.QuickSurvey( options );
} else {
-   $panel.appendTo( $bodyContent );
+   panel = new 
mw.extQuickSurveys.views.ExternalSurvey( options );
}
-   // survey.module contains i18n messages
-

[MediaWiki-commits] [Gerrit] Setup survey bucketing - change (mediawiki...QuickSurveys)

2015-08-25 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/233763

Change subject: Setup survey bucketing
..

Setup survey bucketing

Gets a bucket for each enabled survey.
Shows the first survey in bucket A that has not been
previously dismissed.

Based on upstreamed experiment work:
Icf7f6fedf0c2deb5d5548c9e24456cc7a7c6a743

Bug: T109518
Change-Id: Ib09477d30480116cdb6f3744cb6e77dc2b57817c
---
M extension.json
M resources/ext.quicksurveys.init/init.js
2 files changed, 85 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/63/233763/1

diff --git a/extension.json b/extension.json
index 8229c7f..8cdc8cd 100644
--- a/extension.json
+++ b/extension.json
@@ -56,7 +56,8 @@
"position": "top",
"dependencies": [
"mediawiki.user",
-   "mediawiki.storage"
+   "mediawiki.storage",
+   "mediawiki.experiments"
],
"targets": [
"mobile",
@@ -108,7 +109,7 @@
"@schema": "Which schema to log to",
"schema": "QuickSurveysResponse",
"@enabled": "whether the survey is enabled",
-   "enabled": false,
+   "enabled": true,
"@coverage": "percentage of users that will see 
the survey",
"coverage": "50",
"@platform": "for each platform (desktop, 
mobile), which version of it is targeted (stable, beta, alpha)",
diff --git a/resources/ext.quicksurveys.init/init.js 
b/resources/ext.quicksurveys.init/init.js
index 66af138..7d9af09 100644
--- a/resources/ext.quicksurveys.init/init.js
+++ b/resources/ext.quicksurveys.init/init.js
@@ -1,52 +1,98 @@
 ( function ( $ ) {
-   var survey, token, storageId, $bodyContent, $place,
+   var survey, $bodyContent, $place,
$panel = $( '' ),
availableSurveys = mw.config.get( 'wgEnabledQuickSurveys' ),
-   // https://phabricator.wikimedia.org/T109010
-   inSample = false,
isMainPage = mw.config.get( 'wgIsMainPage' ),
-   isArticle = mw.config.get( 'wgIsArticle' );
+   isArticle = mw.config.get( 'wgIsArticle' ),
+   sessionId = mw.user.generateRandomSessionId();
 
mw.extQuickSurveys = mw.extQuickSurveys || {};
 
+   // Do nothing when not on an article
+   if ( isMainPage && !isArticle ) {
+   return;
+   }
+
if ( availableSurveys.length ) {
-   survey = availableSurveys[ Math.floor( Math.random() * 
availableSurveys.length ) ];
-   storageId = 'ext-quicksurvey-' + survey.name;
-   token = mw.storage.get( storageId );
+   // Get first survey in bucket A that has not been dismissed
+   $( availableSurveys ).each( function ( i, surveyConfig ) {
+   var bucket = getBucket( surveyConfig ),
+   token = getSurveyToken( surveyConfig );
 
-   // local storage is supported in this case as value is not 
false and when ~ it means it was dismissed
-   if ( token !== false && token !== '~' && !isMainPage && 
isArticle ) {
-
-   if ( !token ) {
-   token = mw.user.generateRandomSessionId();
-   // given token !== false we can safely run this 
without exception:
-   mw.storage.set( storageId, token );
+   if ( bucket === 'A' && token !== '~' ) {
+   survey = surveyConfig;
+   return true;
}
+   } );
 
-   if ( inSample || mw.util.getParamValue( 'quicksurvey' ) 
) {
-   $bodyContent = $( '#bodyContent' );
-   $place = $bodyContent.find( 'h1, h2, h3, h4, 
h5, h6' ).eq( 0 );
+   if ( survey ) {
+   $bodyContent = $( '#bodyContent' );
+   $place = $bodyContent.find( 'h1, h2, h3, h4, h5, h6' 
).eq( 0 );
 
-   if ( $place.length ) {
-   $panel.insertBefore( $place );
-   } else {
-   $panel.appendTo( $bodyContent );
-   }
-   mw.loader.using( [ survey.module, 
'ext.quicksurveys.views' ] ).done( function () {
-   var panel;
- 

[MediaWiki-commits] [Gerrit] Pull in survey module and use messages for internal survey - change (mediawiki...QuickSurveys)

2015-08-20 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232862

Change subject: Pull in survey module and use messages for internal survey
..

Pull in survey module and use messages for internal survey

Change-Id: I68d62fd2d6cc4021f897aa2bdc75de49387cd75c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/ext.quicksurveys.init/init.js
4 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/62/232862/1

diff --git a/extension.json b/extension.json
index ad72991..8229c7f 100644
--- a/extension.json
+++ b/extension.json
@@ -98,7 +98,7 @@
"@question": "survey question message key",
"question": 
"ext-quicksurveys-example-internal-survey-question",
"@description": "The message key of the 
description of the survey. Displayed immediately below the survey question.",
-   "description": "",
+   "description": 
"ext-quicksurveys-example-internal-survey-description",
"@answers": "possible answer message keys for 
positive, neutral, and negative",
"answers": {
"positive": 
"ext-quicksurveys-example-internal-survey-answer-positive",
diff --git a/i18n/en.json b/i18n/en.json
index 8641787..cb37544 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -9,6 +9,7 @@
},
"quicksurveys-desc": "Displays configured surveys on Mobile and 
Desktop.",
"ext-quicksurveys-example-internal-survey-question": "Should the text 
be bigger?",
+   "ext-quicksurveys-example-internal-survey-description": "This is the 
description of the example internal survey",
"ext-quicksurveys-example-internal-survey-answer-positive": "Yes",
"ext-quicksurveys-example-internal-survey-answer-neutral": "Not sure",
"ext-quicksurveys-example-internal-survey-answer-negative": "No",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f73098f..614a52b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,11 +10,12 @@
},
"quicksurveys-desc": 
"{{desc|name=QuickSurveys|url=https://www.mediawiki.org/wiki/Extension:QuickSurveys}}";,
"ext-quicksurveys-example-internal-survey-question": "The question for 
the example internal survey",
+   "ext-quicksurveys-example-internal-survey-description": "Description of 
the example internal survey",
"ext-quicksurveys-example-internal-survey-answer-positive": "The 
positive answer for the example internal survey\n{{Identical|Yes}}",
"ext-quicksurveys-example-internal-survey-answer-neutral": "The neutral 
answer for the example internal survey\n{{Identical|Not sure}}",
"ext-quicksurveys-example-internal-survey-answer-negative": "The 
negative answer for the example internal survey\n{{Identical|No}}",
"ext-quicksurveys-example-external-survey-link": "Web link to the 
external survey",
-   "ext-quicksurveys-example-external-survey-description": "description of 
the example survey",
+   "ext-quicksurveys-example-external-survey-description": "Description of 
the example external survey",
"ext-quicksurveys-example-external-survey-privacy-policy-link": "Web 
link to the privacy policy",
"ext-quicksurveys-example-external-survey-privacy-policy-text": "text 
of the privacy policy link\n{{Identical|Privacy policy}}",
"ext-quicksurveys-survey-privacy-policy-default-text": "Default 
disclaimer about submitting surveys.",
diff --git a/resources/ext.quicksurveys.init/init.js 
b/resources/ext.quicksurveys.init/init.js
index 2708aa8..66af138 100644
--- a/resources/ext.quicksurveys.init/init.js
+++ b/resources/ext.quicksurveys.init/init.js
@@ -32,13 +32,13 @@
} else {
$panel.appendTo( $bodyContent );
}
-   mw.loader.using( 'ext.quicksurveys.views' 
).done( function () {
+   mw.loader.using( [ survey.module, 
'ext.quicksurveys.views' ] ).done( function () {
var panel;
panel = new 
mw.extQuickSurveys.views.QuickSurvey( {
survey: survey,
templateData: {
-   question: 
survey.question,
-   description: 
survey.description
+   question: mw.msg( 
survey.question ),
+   description: mw.msg( 
survey.description )
 

[MediaWiki-commits] [Gerrit] Null is not falsy in js so always set the value of wgIsMainPage - change (mediawiki/core)

2015-08-20 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232842

Change subject: Null is not falsy in js so always set the value of wgIsMainPage
..

Null is not falsy in js so always set the value of wgIsMainPage

Change-Id: I2e39f939386f6d9254ef7e11cf584d7ce53e00c1
---
M includes/OutputPage.php
1 file changed, 1 insertion(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/232842/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 8d4720b..8860299 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3280,9 +3280,7 @@
$vars['wgRestriction' . ucfirst( $type )] = 
$title->getRestrictions( $type );
}
 
-   if ( $title->isMainPage() ) {
-   $vars['wgIsMainPage'] = true;
-   }
+   $vars['wgIsMainPage'] = $vars['wgIsMainPage'] ? true : false;
 
if ( $this->mRedirectedFrom ) {
$vars['wgRedirectedFrom'] = 
$this->mRedirectedFrom->getPrefixedDBkey();

-- 
To view, visit https://gerrit.wikimedia.org/r/232842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e39f939386f6d9254ef7e11cf584d7ce53e00c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] WIP: Don't change wgResourceLoaderModules inside hook - change (mediawiki...MobileFrontend)

2015-08-18 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232304

Change subject: WIP: Don't change wgResourceLoaderModules inside hook
..

WIP: Don't change wgResourceLoaderModules inside hook

bug: T102708
Change-Id: Iba22cb403c84668c18d0d3a070ee2ad87722fe56
---
M includes/MobileFrontend.hooks.php
M resources/mobile.loggingSchemas/init.js
2 files changed, 19 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/04/232304/1

diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 861c0bc..07cd42a 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -896,7 +896,7 @@
 * @return bool Always true
 */
public static function onResourceLoaderRegisterModules( ResourceLoader 
&$resourceLoader ) {
-   self::registerMobileLoggingSchemasModule();
+   self::registerMobileLoggingSchemasModule( $resourceLoader );
$config = MobileContext::singleton()->getMFConfig();
 
// add VisualEditor related modules only, if VisualEditor seems 
to be installed - T85007
@@ -966,7 +966,6 @@
},
array_keys( $mobileEventLoggingSchemas )
);
-   self::registerMobileLoggingSchemasModule( 
$additionalDependencies, true );
 
return true;
}
@@ -975,21 +974,11 @@
 * Registers the mobile.loggingSchemas module with any additional
 * dependencies.
 *
-* @param array $additionalDependencies Additional dependencies that 
the module
-*  depends on. Defaults to empty array
-* @param boolean $overwrite Whether or not to re-register the module 
if it has
-*  already been registered. Defaults to false
+* @param ResourceLoader &$resourceLoader The ResourceLoader object
 */
-   private static function registerMobileLoggingSchemasModule(
-   $additionalDependencies = array(),
-   $overwrite = false
-   ) {
+   private static function registerMobileLoggingSchemasModule( 
$resourceLoader ) {
// FIXME: Use Config object when setting of configuration 
values is possible.
-   global $wgResourceModules, $wgMFResourceFileModuleBoilerplate;
-
-   if ( isset( $wgResourceModules['mobile.loggingSchemas'] ) && 
!$overwrite ) {
-   return;
-   }
+   global $wgMFResourceFileModuleBoilerplate;
 
$scripts = array(
'resources/mobile.loggingSchemas/SchemaMobileWeb.js',
@@ -1000,14 +989,16 @@

'resources/mobile.loggingSchemas/SchemaMobileWebBrowse.js',
);
 
-   $wgResourceModules['mobile.loggingSchemas'] = 
$wgMFResourceFileModuleBoilerplate + array(
-   'dependencies' => array_merge( $additionalDependencies, 
array(
+   $loggingSchemasModule = $wgMFResourceFileModuleBoilerplate + 
array(
+   'dependencies' => array(
'mobile.startup',
'mobile.settings',
-   ) ),
+   ),
'scripts' => $scripts,
);
 
+   $resourceLoader->register( array( 'mobile.loggingSchemas' => 
$loggingSchemasModule ) );
+
$wgResourceModules['skins.minerva.scripts']
['scripts'][] = 
'resources/mobile.loggingSchemas/init.js';
}
diff --git a/resources/mobile.loggingSchemas/init.js 
b/resources/mobile.loggingSchemas/init.js
index 6aafc71..88a0cae 100644
--- a/resources/mobile.loggingSchemas/init.js
+++ b/resources/mobile.loggingSchemas/init.js
@@ -23,4 +23,14 @@
uiSchema.hijackLink( $profileLink, 'lastmodified-profile' );
uiSchema.hijackLink( '.nearby-button', 'nearby-button' );
} );
+   mw.loader.load( [
+   'schema.MobileWebBrowse',
+   'schema.MobileWebDiffClickTracking',
+   'schema.MobileWebEditing',
+   'schema.MobileWebMainMenuClickTracking',
+   'schema.MobileWebSearch',
+   'schema.MobileWebUIClickTracking',
+   'schema.MobileWebWatching',
+   'schema.MobileWebWatchlistClickTracking',
+   ] );
 } )( mw.mobileFrontend, jQuery );

-- 
To view, visit https://gerrit.wikimedia.org/r/232304
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba22cb403c84668c18d0d3a070ee2ad87722fe56
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list

[MediaWiki-commits] [Gerrit] Register enabled surveys as RL modules via hook - change (mediawiki...QuickSurveys)

2015-08-17 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232210

Change subject: Register enabled surveys as RL modules via hook
..

Register enabled surveys as RL modules via hook

This creates a module per survey configured with survey messages
for server side translation.  This can also be responsible for
registering any additional dependencies based on survey configuration.

Additionally:
- Fixed the QuickSurveysConfig so the config can be read
- Creates language keys for link, privacy-policy-link, and
privacy-policy-text

bug: T107586
Change-Id: I8ab993130bf3fe60de461ecdcff66b494281c310
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/QuickSurveys.hooks.php
4 files changed, 75 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/10/232210/1

diff --git a/extension.json b/extension.json
index 7e1a91c..30e4411 100644
--- a/extension.json
+++ b/extension.json
@@ -26,10 +26,13 @@
"Hooks": {
"ResourceLoaderGetConfigVars": [
"QuickSurveys\\Hooks::onResourceLoaderGetConfigVars"
+   ],
+   "ResourceLoaderRegisterModules": [
+   "QuickSurveys\\Hooks::onResourceLoaderRegisterModules"
]
},
"config": {
-   "@QuickSurveysConfig": [
+   "QuickSurveysConfig": [
{
"@name": "survey name",
"name": "internal example survey",
@@ -48,7 +51,7 @@
"@schema": "Which schema to log to",
"schema": "QuickSurveysResponse",
"@enabled": "whether the survey is enabled",
-   "enabled": false,
+   "enabled": true,
"@coverage": "percentage of users that will see 
the survey",
"coverage": "50",
"@platform": "for each platform (desktop, 
mobile), which version of it is targeted (stable, beta, alpha)",
@@ -64,13 +67,13 @@
"@description": "description of the survey",
"description": 
"ext-quicksurveys-example-external-survey-description",
"@link": "external link to the survey",
-   "link": "//example.org/survey",
+   "link": 
"ext-quicksurveys-example-external-survey-link",
"@privacy-policy-link": "link to the privacy 
policy",
-   "privacy-policy-link": 
"//example.org/privacy-policy",
+   "privacy-policy-link": 
"ext-quicksurveys-example-external-survey-privacy-policy-link",
"@privacy-policy-text": "text of the privacy 
policy",
"privacy-policy-text": 
"ext-quicksurveys-example-external-survey-privacy-policy-text",
"@enabled": "whether the survey is enabled",
-   "enabled": false,
+   "enabled": true,
"@coverage": "percentage of users that will see 
the survey",
"coverage": "50",
"@platform": "for each platform (desktop, 
mobile), which version of it is targeted (stable, beta, alpha)",
diff --git a/i18n/en.json b/i18n/en.json
index f53bfb4..b99949a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,6 +12,8 @@
"ext-quicksurveys-example-internal-survey-answer-positive": "Yes",
"ext-quicksurveys-example-internal-survey-answer-neutral": "Not sure",
"ext-quicksurveys-example-internal-survey-answer-negative": "No",
+   "ext-quicksurveys-example-external-survey-link": "//example.org/survey",
"ext-quicksurveys-example-external-survey-description": "This is the 
description of the example external survey.",
+   "ext-quicksurveys-example-external-survey-privacy-policy-link": 
"//example.org/privacy-policy",
"ext-quicksurveys-example-external-survey-privacy-policy-text": 
"Privacy Policy"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 03c7a2a..bcf6063 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -13,6 +13,8 @@
"ext-quicksurveys-example-internal-survey-answer-positive": "The 
positive answer for the example internal survey\n{{Identical|Yes}}",
"ext-quicksurveys-example-internal-survey-answer-neutral": "The neutral 
answer for the example internal survey\n{{Identical|Not sure}}",
"ext-quicksurveys-example-internal-survey-answer-negative": "The 
negative answer for the example internal survey\n{{Identical|No}}",
+   "ext-quicksurveys-example-

[MediaWiki-commits] [Gerrit] Queue mobile head inline scripts with Resource Loader - change (mediawiki...MobileFrontend)

2015-08-12 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231188

Change subject: Queue mobile head inline scripts with Resource Loader
..

Queue mobile head inline scripts with Resource Loader

Bug: T108204
Change-Id: Ic6ec48850800d9cf661337135e8f9cf063958dfe
---
M includes/skins/MinervaTemplate.php
1 file changed, 19 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/88/231188/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index fe42b9c..97dc1a4 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -318,27 +318,26 @@
protected function renderContentWrapper( $data ) {
if ( $this->renderHistoryLinkBeforeContent ) {
echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-   
-   makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
}
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'header-loaded' ); }
-   
-   renderPreContent( $data );
-   $this->renderContent( $data );
-   if ( !$this->renderHistoryLinkBeforeContent ) {
-   echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-   
-   makeInlineMobileHeadEmitScript( 'header-loaded' );
+   $this->renderPreContent( $data );
+   $this->renderContent( $data );
+   if ( !$this->renderHistoryLinkBeforeContent ) {
+   echo $this->getHistoryLinkTopHtml( $data );
+   echo $this->makeInlineMobileHeadEmitScript( 
'history-link-loaded' );
+   }
+   }
+
+   /**
+* Wrap a mobileFrontend emit script in RLQ.push()
+* @param string $event Event to emit
+*/
+   protected function makeInlineMobileHeadEmitScript( $event ) {
+   $script = "mw.loader.using( 'mobile.head', function () {";
+   $script .= "mw.mobileFrontend.emit( '" . $event . "' );";
+   $script .= "} );";
+   return ResourceLoader::makeInlineScript( $script );
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/231188
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6ec48850800d9cf661337135e8f9cf063958dfe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Don't hardcode script tags. Use RL makeInlineScript method - change (mediawiki...MobileFrontend)

2015-08-10 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/230653

Change subject: Don't hardcode script tags. Use RL makeInlineScript method
..

Don't hardcode script tags. Use RL makeInlineScript method

Change-Id: I6105d12a4eb279e9806de5304f2a48583f069b96
---
M includes/skins/MinervaTemplate.php
1 file changed, 8 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/53/230653/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index fe42b9c..c0c06e8 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -318,27 +318,15 @@
protected function renderContentWrapper( $data ) {
if ( $this->renderHistoryLinkBeforeContent ) {
echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-   
-   
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'header-loaded' ); }
-   
-   renderPreContent( $data );
-   $this->renderContent( $data );
-   if ( !$this->renderHistoryLinkBeforeContent ) {
-   echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-   
-   renderPreContent( $data );
+   $this->renderContent( $data );
+   if ( !$this->renderHistoryLinkBeforeContent ) {
+   echo $this->getHistoryLinkTopHtml( $data );
+   ResourceLoader::makeInlineScript( 
"mw.mobileFrontend.emit( 'history-link-loaded' );" );
+   }
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/230653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6105d12a4eb279e9806de5304f2a48583f069b96
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] QuickSurveys extension boilerplate commit - change (mediawiki...QuickSurveys)

2015-08-07 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/230237

Change subject: QuickSurveys extension boilerplate commit
..

QuickSurveys extension boilerplate commit

Bug: T107581
Change-Id: I258e4cda2e3a4acd4f0a2162194c47c4b9fc5e1e
---
A QuickSurveys.php
A phpcs.xml
2 files changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/37/230237/1

diff --git a/QuickSurveys.php b/QuickSurveys.php
new file mode 100644
index 000..b88b819
--- /dev/null
+++ b/QuickSurveys.php
@@ -0,0 +1,13 @@
+https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   ); */
+   return;
+} else {
+   die( 'This version of the QuickSurveys extension requires MediaWiki 
1.25+' );
+}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..cb19440
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,7 @@
+
+
+   
+   .
+   
+   vendor
+

-- 
To view, visit https://gerrit.wikimedia.org/r/230237
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I258e4cda2e3a4acd4f0a2162194c47c4b9fc5e1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: master
Gerrit-Owner: Robmoen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Example QuickSurvey config and expose enabled surveys to bro... - change (mediawiki...QuickSurveys)

2015-08-06 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/229989

Change subject: Example QuickSurvey config and expose enabled surveys to browser
..

Example QuickSurvey config and expose enabled surveys to browser

To test, require QuickSurveys.php as it will load the config.
Enable the example survey by editing the config
run mw.config.get( 'wgEnabledQuickSurveys ') in console.

Bug: T107586
Change-Id: I2e65c4b008635cd0ee42ba8501cf64dea047b0ae
---
D QuickSurveys.hooks.php
M QuickSurveys.php
M extension.json
M i18n/en.json
A includes/Config.php
A includes/QuickSurveys.hooks.php
6 files changed, 96 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys 
refs/changes/89/229989/1

diff --git a/QuickSurveys.hooks.php b/QuickSurveys.hooks.php
deleted file mode 100644
index fb0d82e..000
--- a/QuickSurveys.hooks.php
+++ /dev/null
@@ -1,11 +0,0 @@
-https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
); */
-   return;
 } else {
die( 'This version of the QuickSurveys extension requires MediaWiki 
1.25+' );
 }
+
+/**
+ * Begin configuration variables
+ * FIXME: Ideally survey configuration would live in extension.json and it
+ * must be loaded somewhere other than here before being deployed in 
production.
+ * However, since it is a requirement that disabled surveys be hidden from
+ * the browser, they cannot live in extension.json for now as it is viewable.
+ * See: https://phabricator.wikimedia.org/T107586
+ */
+require_once __DIR__ . "/includes/Config.php";
\ No newline at end of file
diff --git a/extension.json b/extension.json
index 3270830..32cdad9 100644
--- a/extension.json
+++ b/extension.json
@@ -16,8 +16,16 @@
"i18n"
]
},
-   "AutoloadClasses": {
-   "QuickSurveysHooks": "QuickSurveys.hooks.php"
+   "ConfigRegistry": {
+   "quicksurveys": "GlobalVarConfig::newInstance"
},
-   "manifest_version": 1
+   "AutoloadClasses": {
+   "QuickSurveys\\Hooks": "includes/QuickSurveys.hooks.php"
+   },
+   "manifest_version": 1,
+   "Hooks": {
+   "ResourceLoaderGetConfigVars": [
+   "QuickSurveys\\Hooks::onResourceLoaderGetConfigVars"
+   ]
+   }
 }
diff --git a/i18n/en.json b/i18n/en.json
index df2fe84..5cdd611 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,5 +7,9 @@
"Rob Moen"
]
},
-   "quicksurveys-desc": "Displays configured surveys on Mobile and 
Desktop."
+   "quicksurveys-desc": "Displays configured surveys on Mobile and 
Desktop.",
+   "ext-quicksurveys-example-question": "Which describes your thoughts 
about Wikipedia.",
+   "ext-quicksurveys-example-answer-positive": "Love it",
+   "ext-quicksurveys-example-answer-neutral" : "It's ok",
+   "ext-quicksurveys-example-answer-negative": "Not for me"
 }
diff --git a/includes/Config.php b/includes/Config.php
new file mode 100644
index 000..8c3b0bd
--- /dev/null
+++ b/includes/Config.php
@@ -0,0 +1,28 @@
+ 'example',
+   // Internal or external link survey
+   'type' => 'internal',
+   // Survey question message key
+   'question' => 'ext-quicksurveys-example-question',
+   // Possible answer message keys for positive, neutral, and negative
+   'answers' => array(
+   'positive' => 'ext-quicksurveys-example-answer-positive',
+   'neutral' =>  'ext-quicksurveys-example-answer-neutral',
+   'negative' => 'ext-quicksurveys-example-answer-negative',
+   ),
+   // Which schema to log to
+   'schema' => 'QuickSurveysResponses',
+   // Percentage of users that will see the survey
+   'coverage' => '50',
+   // Is the survey enabled
+   'enabled' => false,
+   // For each platform (desktop, mobile), which version of it is targeted 
(stable, beta, alpha)
+   'platform' => array(
+   'desktop' => array( 'stable' ),
+   'mobile' => array( 'stable', 'beta', 'alpha' ),
+   ),
+);
\ No newline at end of file
diff --git a/includes/QuickSurveys.hooks.php b/includes/QuickSurveys.hooks.php
new file mode 100644
index 000..3e71c50
--- /dev/null
+++ b/includes/QuickSurveys.hooks.php
@@ -0,0 +1,42 @@
+()
+ * For intance, the hook handler for the 'RequestContextCreateSkin' would be 
called:
+ * onRequestContextCreateSkin()
+ */
+class Hooks {
+   /**
+* ResourceLoaderGetConfigVars hook handler
+* @see 
https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
+*
+* @param array $vars
+* @return boolean
+*/
+   public static function onResourceLoaderGetConfigVars( &$vars ) {
+   $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'quicksu

[MediaWiki-commits] [Gerrit] Init last modified when the module is loaded - change (mediawiki...MobileFrontend)

2015-08-06 Thread Robmoen (Code Review)
Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/229859

Change subject: Init last modified when the module is loaded
..

Init last modified when the module is loaded

* Sets visibility to .last-modified-bar to hidden while
module is loading
* Remove inline scripts for emitting history-link-loaded
From MinervaTemplate.php
* Results in last modified being restyled without a flash
or a dom reflow.

Bug: T108204
Change-Id: I508ca6a94d5b2d7a134e39637ea2f87f3ddc5430
---
M includes/skins/MinervaTemplate.php
M resources/mobile.head/init.js
M resources/skins.minerva.base.styles/ui.less
3 files changed, 7 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/59/229859/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index e9139ff..04b22c9 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -318,11 +318,6 @@
protected function renderContentWrapper( $data ) {
if ( $this->renderHistoryLinkBeforeContent ) {
echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-   
-   if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-   
-   

@@ -333,11 +328,6 @@
$this->renderContent( $data );
if ( !$this->renderHistoryLinkBeforeContent ) {
echo $this->getHistoryLinkTopHtml( $data );
-   ?>
-