jenkins-bot has submitted this change and it was merged.
Change subject: Stories 902, 903: Promoting pageactions (including editing) to
stable
......................................................................
Stories 902, 903: Promoting pageactions (including editing) to stable
* Makes mf-api.js a startup module (now needed by history.js)
* Address FIXMES in lead photo upload and css
Also removing unused 'pagetitle' message
Change-Id: I7c1379874b115cf05ebd932b2f713d94062e08ee
Dependancy: I466d36e48dec1f798f38152c829a25eb80f8b67b
---
M includes/Resources.php
M includes/skins/MinervaTemplate.php
M includes/skins/MobileTemplateBeta.php
M includes/skins/SkinMinerva.php
M includes/skins/SkinMobileBeta.php
D javascripts/common/application-beta.js
D javascripts/common/history-beta.js
M javascripts/common/history.js
M javascripts/common/mf-application.js
M javascripts/modules/uploads/lead-photo-init.js
M less/common/mf-navigation.less
M less/common/pageactions.less
M less/common/ui.less
M less/common/user.less
M less/mf-variables.less
M less/modules/mf-toggle.less
M stylesheets/common/drawer.css
M stylesheets/common/mf-enwp.css
M stylesheets/common/mf-footer.css
M stylesheets/common/mf-navigation.css
M stylesheets/common/mf-typography.css
M stylesheets/common/overlays.css
M stylesheets/common/pageactions.css
M stylesheets/common/pagelist.css
M stylesheets/common/ui.css
M stylesheets/modules/mf-photo.css
M stylesheets/modules/mf-toggle.css
M stylesheets/modules/tutorials.css
M stylesheets/specials/uploads.css
29 files changed, 296 insertions(+), 404 deletions(-)
Approvals:
JGonera: Looks good to me, but someone else must approve
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Resources.php b/includes/Resources.php
index 75f6282..836a0d0 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -113,13 +113,13 @@
'stylesheets/common/overlays.css',
'stylesheets/common/drawer.css',
'stylesheets/common/mf-hacks.css',
+ 'stylesheets/common/pageactions.css',
),
'position' => 'top',
),
'mobile.styles.beta' => $wgMFMobileResourceBoilerplate + array(
'styles' => array(
- 'stylesheets/common/pageactions.css',
'stylesheets/common/user.css',
),
'position' => 'top',
@@ -144,6 +144,7 @@
'javascripts/common/eventemitter.js',
'javascripts/common/Router.js',
'javascripts/common/mf-application.js',
+ 'javascripts/common/mf-api.js',
'javascripts/common/history.js',
'javascripts/common/mf-settings.js',
'javascripts/modules/mf-stop-mobile-redirect.js',
@@ -167,50 +168,9 @@
'mobile-frontend-photo-nag-learn-more-1' => array(
'parse' ),
'mobile-frontend-photo-nag-learn-more-2' => array(
'parse' ),
'mobile-frontend-photo-nag-learn-more-3' => array(
'parse' ),
- ),
- 'localBasePath' => $localBasePath,
- 'localTemplateBasePath' => $localBasePath . '/templates',
- 'templates' => array(
- 'wikitext/commons-upload',
- // LanguageOverlay.js
- 'overlays/languages',
- // leadphoto.js
- 'leadPhoto',
- 'overlay',
- 'overlays/cleanup',
- 'overlays/learnMore',
- // search-2.js
- 'articleList',
- 'overlays/search/search',
- // PhotoUploader.js
- // For new page action menu
- 'photoUploadAction',
- 'photoUploader',
- // PhotoUploaderPreview.js
- 'photoUploadPreview',
- // NagOverlay.js
- 'photoNag',
- 'ctaDrawer',
- ),
- 'class' => 'MFResourceLoaderModule',
- ),
-
- 'mobile.beta.plumbing' => array(
- 'localBasePath' => $localBasePath,
- 'localTemplateBasePath' => $localBasePath . '/templates',
- 'templates' => array(
- 'overlays/editor',
- 'section',
- // talk.js
- 'overlays/talk',
- 'overlays/talkSectionAdd',
- 'talkSection',
// page.js
- 'page',
- 'pageActionTutorial',
- 'languageSection',
- ),
- 'messages' => array(
+ 'mobile-frontend-talk-overlay-header',
+ 'mobile-frontend-language-article-heading',
// editor.js
'mobile-frontend-editor-disabled',
'mobile-frontend-editor-cta',
@@ -235,10 +195,49 @@
'mobile-frontend-editor-error-preview',
// modules/editor/EditorOverlay.js and modules/talk.js
'mobile-frontend-editor-save',
+ ),
+ 'localBasePath' => $localBasePath,
+ 'localTemplateBasePath' => $localBasePath . '/templates',
+ 'templates' => array(
+ 'overlays/editor',
+ 'section',
+ 'wikitext/commons-upload',
+ // LanguageOverlay.js
+ 'overlays/languages',
+ // leadphoto.js
+ 'leadPhoto',
+ 'overlay',
+ 'overlays/cleanup',
+ 'overlays/learnMore',
+ // search-2.js
+ 'articleList',
+ 'overlays/search/search',
// page.js
- 'mobile-frontend-talk-overlay-header',
- // history-beta.js
- 'mobile-frontend-language-article-heading',
+ 'page',
+ 'languageSection',
+ // PhotoUploader.js
+ // For new page action menu
+ 'photoUploadAction',
+ 'photoUploader',
+ // PhotoUploaderPreview.js
+ 'photoUploadPreview',
+ // NagOverlay.js
+ 'photoNag',
+ 'ctaDrawer',
+ ),
+ 'class' => 'MFResourceLoaderModule',
+ ),
+
+ 'mobile.beta.plumbing' => array(
+ 'localBasePath' => $localBasePath,
+ 'localTemplateBasePath' => $localBasePath . '/templates',
+ 'templates' => array(
+ // talk.js
+ 'overlays/talk',
+ 'overlays/talkSectionAdd',
+ 'talkSection',
+ // page.js
+ 'pageActionTutorial',
),
'class' => 'MFResourceLoaderModule',
),
@@ -249,14 +248,9 @@
'mobile.stable.common',
),
'scripts' => array(
- 'javascripts/common/application-beta.js',
- 'javascripts/common/history-beta.js',
- 'javascripts/views/page.js',
'javascripts/common/ContentOverlay.js',
),
'messages' => array(
- // page.js and talk.js (alpha)
- 'mobile-frontend-talk-overlay-header',
// LanguageOverlay.js
'mobile-frontend-language-header',
'mobile-frontend-language-site-choose',
@@ -270,13 +264,9 @@
'mobile.beta.common',
),
'styles' => array(
- 'stylesheets/modules/editor.css',
'stylesheets/modules/talk.css',
),
'scripts' => array(
- 'javascripts/modules/editor/EditorApi.js',
- 'javascripts/modules/editor/EditorOverlay.js',
- 'javascripts/modules/editor/editor.js',
'javascripts/modules/mf-toggle-dynamic.js',
'javascripts/modules/talk/TalkSectionOverlay.js',
'javascripts/modules/talk.js',
@@ -288,8 +278,6 @@
),
'position' => 'bottom',
'messages' => array(
- 'pagetitle',
-
// for mf-toggle-dynamic.js
'mobile-frontend-show-button',
'mobile-frontend-hide-button',
@@ -350,9 +338,6 @@
// for mf-table.js
'mobile-frontend-table',
- // history-alpha.js
- 'mobile-frontend-language-article-heading',
-
// nearbypages.js
'mobile-frontend-nearby-to-page',
),
@@ -387,6 +372,7 @@
'stylesheets/modules/mf-watchstar.css',
'stylesheets/modules/mf-photo.css',
'stylesheets/modules/tutorials.css',
+ 'stylesheets/modules/editor.css',
),
'position' => 'top',
),
@@ -400,7 +386,6 @@
'mediawiki.jqueryMsg',
),
'scripts' => array(
- 'javascripts/common/mf-api.js',
'javascripts/common/mf-view.js',
'javascripts/common/Drawer.js',
'javascripts/common/CtaDrawer.js',
@@ -408,6 +393,7 @@
'javascripts/widgets/progress-bar.js',
'javascripts/common/mf-navigation.js',
'javascripts/common/mf-notification.js',
+ 'javascripts/views/page.js',
// Upload specific code
'javascripts/modules/uploads/LearnMoreOverlay.js',
'javascripts/modules/uploads/PhotoApi.js',
@@ -471,6 +457,9 @@
'mobile.stable.styles',
),
'scripts' => array(
+ 'javascripts/modules/editor/EditorApi.js',
+ 'javascripts/modules/editor/EditorOverlay.js',
+ 'javascripts/modules/editor/editor.js',
'javascripts/modules/mf-toggle.js',
'javascripts/modules/mf-cleanuptemplates.js',
'javascripts/modules/languages.js',
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index 9d7239e..f3c4e50 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -102,12 +102,14 @@
$isSpecialPage = $this->getSkin()->getTitle()->isSpecialPage();
?>
<div class='show' id='content_wrapper'>
+ <?php
+ if ( !$isSpecialPage ) {
+ echo $data['prebodytext'];
+ $this->renderPageActions( $data );
+ }
+ ?>
<div id="content" class="content">
<?php
- if ( !$isSpecialPage ) {
- echo $data['prebodytext'];
- $this->renderPageActions( $data
);
- }
echo $data[ 'bodytext' ];
$this->renderLanguages();
$this->renderHistoryLink( $data );
diff --git a/includes/skins/MobileTemplateBeta.php
b/includes/skins/MobileTemplateBeta.php
index d1f6e76..af58f4b 100644
--- a/includes/skins/MobileTemplateBeta.php
+++ b/includes/skins/MobileTemplateBeta.php
@@ -1,23 +1,3 @@
<?php
class MobileTemplateBeta extends MobileTemplate {
- protected function renderContentWrapper( $data ) {
- $isSpecialPage = $this->getSkin()->getTitle()->isSpecialPage();
- ?>
- <div class='show' id='content_wrapper'>
- <?php
- if ( !$isSpecialPage ) {
- echo $data['prebodytext'];
- $this->renderPageActions( $data );
- }
- ?>
- <div id="content" class="content">
- <?php
- echo $data[ 'bodytext' ];
- $this->renderLanguages( $data );
- $this->renderHistoryLink( $data );
- ?>
- </div>
- </div>
- <?php
- }
}
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index c0dc37b..406bc52 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -22,6 +22,30 @@
$out->addJsConfigVars( $this->getSkinConfigVariables() );
}
+ /**
+ * Prepares the user button.
+ * @param $tpl BaseTemplate
+ */
+ protected function prepareUserButton( BaseTemplate $tpl ) {
+ if ( class_exists( 'MWEchoNotifUser' ) ) {
+ $user = $this->getUser();
+ // FIXME: cap higher counts
+ $count = $user->isLoggedIn() ?
MWEchoNotifUser::newFromUser( $user )->getNotificationCount() : 0;
+
+ $tpl->set( 'userButton',
+ Html::openElement( 'a', array(
+ 'title' => wfMessage(
'mobile-frontend-user-button-tooltip' ),
+ 'href' => SpecialPage::getTitleFor(
'Notifications' )->getLocalURL(),
+ 'id'=> 'user-button',
+ ) ) .
+ Html::element( 'span', array( 'class' => $count
? '' : 'zero' ), $count ) .
+ Html::closeElement( 'a' )
+ );
+ } else {
+ $tpl->set( 'userButton', '' );
+ }
+ }
+
public function prepareData( BaseTemplate $tpl ) {
global $wgMFEnableSiteNotice;
$title = $this->getTitle();
@@ -68,7 +92,6 @@
'id'=> 'mw-mf-main-menu-button',
) )
);
- $tpl->set( 'userButton', '<ul id="mw-mf-menu-page"></ul>' );
$banners = array();
if ( $wgMFEnableSiteNotice ) {
@@ -86,6 +109,49 @@
),
) );
$tpl->set( 'page_actions', array() );
+
+ // Reuse template data variable from SkinTemplate to construct
page menu
+ $menu = array();
+ $namespaces = $tpl->data['content_navigation']['namespaces'];
+ $actions = $tpl->data['content_navigation']['actions'];
+
+ // empty placeholder for edit and photos which both require js
+ $menu['edit'] = array( 'id' => 'ca-edit', 'text' => '' );
+ $menu['photo'] = array( 'id' => 'ca-upload', 'text' => '' );
+
+ if ( isset( $namespaces['talk'] ) ) {
+ $menu['talk'] = $namespaces['talk'];
+ // FIXME [Core Skin]: I'm not sure why this is treated
differently.
+ } else if ( isset( $namespaces['project_talk'] ) ) {
+ $menu['talk'] = $namespaces['project_talk'];
+ }
+
+ if ( isset( $menu['talk'] ) ) {
+ if ( isset( $tpl->data['_talkdata'] ) ) {
+ $menu['talk']['text'] =
$tpl->data['_talkdata']['text'];
+ $menu['talk']['class'] =
$tpl->data['_talkdata']['class'];
+ }
+ }
+
+ $watchTemplate = array(
+ 'id' => 'ca-watch',
+ 'class' => 'watch-this-article',
+ );
+ // standardise watch article into one menu item
+ if ( isset( $actions['watch'] ) ) {
+ $menu['watch'] = array_merge( $actions['watch'],
$watchTemplate );
+ } else if ( isset( $actions['unwatch'] ) ) {
+ $menu['watch'] = array_merge( $actions['unwatch'],
$watchTemplate );
+ $menu['watch']['class'] .= ' watched';
+ } else {
+ // placeholder for not logged in
+ $menu['watch'] = $watchTemplate;
+ // FIXME: makeLink (used by makeListItem) when no text
is present defaults to use the key
+ $menu['watch']['text'] = '';
+ }
+
+ $tpl->set( 'page_actions', $menu );
+ $this->prepareUserButton( $tpl );
}
/**
diff --git a/includes/skins/SkinMobileBeta.php
b/includes/skins/SkinMobileBeta.php
index a5a8ea7..f8aa8e9 100644
--- a/includes/skins/SkinMobileBeta.php
+++ b/includes/skins/SkinMobileBeta.php
@@ -13,89 +13,6 @@
$out->addModuleStyles( 'mobile.styles.beta' );
}
- public function prepareData( BaseTemplate $tpl ) {
- parent::prepareData( $tpl );
- $this->prepareDataBeta( $tpl );
- }
-
- /**
- * Prepares data required by the mobile beta skin only. This runs after
prepareData
- * @param $tpl BaseTemplate
- */
- protected function prepareDataBeta( BaseTemplate $tpl ) {
- // Reuse template data variable from SkinTemplate to construct
page menu
- $menu = array();
- $actions = $tpl->data['content_navigation']['actions'];
- $namespaces = $tpl->data['content_navigation']['namespaces'];
-
- // empty placeholder for edit photos which both require js
- $menu['edit'] = array( 'id' => 'ca-edit', 'text' => '' );
- $menu['photo'] = array( 'id' => 'ca-upload', 'text' => '' );
-
- if ( isset( $namespaces['talk'] ) ) {
- $menu['talk'] = $namespaces['talk'];
- // FIXME [Core Skin]: I'm not sure why this is treated
differently.
- } else if ( isset( $namespaces['project_talk'] ) ) {
- $menu['talk'] = $namespaces['project_talk'];
- }
-
- if ( isset( $menu['talk'] ) ) {
- if ( isset( $tpl->data['_talkdata'] ) ) {
- $menu['talk']['text'] =
$tpl->data['_talkdata']['text'];
- $menu['talk']['class'] =
$tpl->data['_talkdata']['class'];
- }
- }
-
- $watchTemplate = array(
- 'id' => 'ca-watch',
- 'class' => 'watch-this-article',
- );
- // standardise watch article into one menu item
- if ( isset( $actions['watch'] ) ) {
- $menu['watch'] = array_merge( $actions['watch'],
$watchTemplate );
- } else if ( isset( $actions['unwatch'] ) ) {
- $menu['watch'] = array_merge( $actions['unwatch'],
$watchTemplate );
- $menu['watch']['class'] .= ' watched';
- } else {
- // placeholder for not logged in
- $menu['watch'] = $watchTemplate;
- // FIXME: makeLink (used by makeListItem) when no text
is present defaults to use the key
- $menu['watch']['text'] = '';
- $menu['watch']['class'] = 'cta';
- }
-
- $tpl->set( 'page_actions', $menu );
-
- $this->prepareUserButton( $tpl );
- }
-
- public function getSkinConfigVariables() {
- $vars = parent::getSkinConfigVariables();
- $vars['wgMFEnablePhotoUploadCTA'] = true;
- return $vars;
- }
- /**
- * Prepares the user button.
- * @param $tpl BaseTemplate
- */
- protected function prepareUserButton( BaseTemplate $tpl ) {
- if ( class_exists( 'MWEchoNotifUser' ) ) {
- $user = $this->getUser();
- // FIXME: cap higher counts
- $count = $user->isLoggedIn() ?
MWEchoNotifUser::newFromUser( $user )->getNotificationCount() : 0;
-
- $tpl->set( 'userButton',
- Html::openElement( 'a', array(
- 'title' => wfMessage(
'mobile-frontend-user-button-tooltip' ),
- 'href' => SpecialPage::getTitleFor(
'Notifications' )->getLocalURL(),
- 'id'=> 'user-button',
- ) ) .
- Html::element( 'span', array( 'class' => $count
? '' : 'zero' ), $count ) .
- Html::closeElement( 'a' )
- );
- }
- }
-
public function getDefaultModules() {
$modules = parent::getDefaultModules();
$modules['beta'] = array( 'mobile.beta' );
diff --git a/javascripts/common/application-beta.js
b/javascripts/common/application-beta.js
deleted file mode 100644
index 7ee9b8b..0000000
--- a/javascripts/common/application-beta.js
+++ /dev/null
@@ -1,17 +0,0 @@
-( function( M, $ ) {
-
- function deParam( qs ) {
- var params = {};
- if ( qs ) {
- qs.split( '&' ).forEach( function( p ) {
- p = p.split( '=' );
- params[ p[0] ] = p[1];
- } );
- }
- return params;
- }
- $.extend( M, {
- deParam: deParam
- } );
-
-}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/common/history-beta.js
b/javascripts/common/history-beta.js
deleted file mode 100644
index fafd174..0000000
--- a/javascripts/common/history-beta.js
+++ /dev/null
@@ -1,122 +0,0 @@
-// FIXME: Turn into extension of api module
-( function( M, $ ) {
- var api = M.require( 'api' ),
- // Internal cache for storing all availabe language codes on
the site
- _languageCache,
- cache = {};
-
- /**
- * Gathers a mapping of all available language codes on the site and
their human readable names
- *
- * @return {jQuery.Deferred} where argument is a javascript object with
language codes as keys
- */
- function retrieveAllLanguages() {
- if ( !_languageCache ) {
- _languageCache = api.get( {
- action: 'query',
- meta: 'siteinfo',
- siprop: 'languages',
- format: 'json'
- } ).then( function( data ) {
- var languages = {};
- data.query.languages.forEach( function( item ) {
- languages[ item.code ] = item[ '*' ];
- } );
- return languages;
- } );
- }
- return _languageCache;
- }
-
- /**
- * Retrieve available languages for a given title
- *
- * @param {Object} title the title of the page languages should be
retrieved for
- * @param {Object} allAvailableLanguages a mapping of language codes to
language names
- * @return {jQuery.Deferred} which is called with a mapping of language
codes to language names
- */
- function retrievePageLanguages( title, allAvailableLanguages ) {
- return api.get( {
- action: 'query',
- prop: 'langlinks',
- llurl: true,
- lllimit: 'max',
- titles: title
- } ).then( function( resp ) {
- // FIXME: API returns an object when a list makes much
more sense
- var pages = $.map( resp.query.pages, function( v ) {
return v; } ),
- // FIXME: "|| []" wouldn't be needed if API was
more consistent
- langlinks = pages[0] ? pages[0].langlinks || []
: [];
-
- langlinks.forEach( function( item, i ) {
- langlinks[ i ].langname =
allAvailableLanguages[ item.lang ];
- } );
- return langlinks;
- } );
- }
-
- /**
- * Invalidate the internal cache for a given page
- *
- * @param {String} pageTitle the title of the page who's cache you want
to invalidate
- */
- function invalidateCachedPage( pageTitle ) {
- delete cache[ pageTitle ];
- }
-
- /**
- * Retrieve a page from the api
- *
- * @param {Object} pageTitle the title of the page to be retrieved
- * @param {String} endpoint an alternative api url to retreive the page
from
- * @param {Boolean} leadOnly When set only the lead section content is
returned
- * @return {jQuery.Deferred} with parameter page data that can be
passed to a Page view
- */
- function retrievePage( pageTitle, endpoint, leadOnly ) {
- var cachedPage = cache[ pageTitle ],
- options = endpoint ? { url: endpoint, dataType: 'jsonp'
} : {};
-
- if ( !cachedPage ) {
- cachedPage = $.Deferred().fail( function() {
- delete cache[ pageTitle ];
- } );
- api.get( {
- action: 'mobileview',
- page: pageTitle,
- variant: mw.config.get( 'wgPreferredVariant' ),
- redirects: 'yes', prop: 'sections|text',
noheadings: 'yes',
- noimages: mw.config.get( 'wgImagesDisabled',
false ) ? 1 : undefined,
- sectionprop: 'level|line|anchor', sections:
leadOnly ? 0 : 'all'
- }, options ).then( function( r ) {
- if ( r.error || !r.mobileview.sections ) {
- cachedPage.reject( r );
- } else {
- cachedPage.resolve( {
- title: pageTitle,
- sections: r.mobileview.sections,
- isMainPage:
r.mobileview.hasOwnProperty( 'mainpage' ) ? true : false
- } );
- }
- } ).fail( function( r ) {
- cachedPage.reject( r );
- } );
- cache[ pageTitle ] = cachedPage;
- }
- return cachedPage;
- }
-
- M.history = $.extend( M.history, {
- invalidateCachedPage: invalidateCachedPage,
- retrieveAllLanguages: retrieveAllLanguages,
- retrievePage: retrievePage,
- retrievePageLanguages: retrievePageLanguages
- } );
-
- M.on( 'section-rendered', function( $content ) {
- // FIXME: this should live in the hidpi module when dynamic
sections is promoted from beta
- if ( $content.hidpi ) {
- $content.hidpi();
- }
- } );
-
-} ( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/common/history.js b/javascripts/common/history.js
index 7ced0ee..1f7fe14 100644
--- a/javascripts/common/history.js
+++ b/javascripts/common/history.js
@@ -2,6 +2,11 @@
M.history = ( function() {
+ var api = M.require( 'api' ),
+ // Internal cache for storing all availabe language codes on
the site
+ _languageCache,
+ cache = {};
+
/**
* Generate a URL for a given page title.
*
@@ -18,8 +23,112 @@
return url;
}
+ /**
+ * Invalidate the internal cache for a given page
+ *
+ * @param {String} pageTitle the title of the page who's cache you want
to invalidate
+ */
+ function invalidateCachedPage( pageTitle ) {
+ delete cache[ pageTitle ];
+ }
+
+ /**
+ * Retrieve a page from the api
+ *
+ * @param {Object} pageTitle the title of the page to be retrieved
+ * @param {String} endpoint an alternative api url to retreive the page
from
+ * @param {Boolean} leadOnly When set only the lead section content is
returned
+ * @return {jQuery.Deferred} with parameter page data that can be
passed to a Page view
+ */
+ function retrievePage( pageTitle, endpoint, leadOnly ) {
+ var cachedPage = cache[ pageTitle ],
+ options = endpoint ? { url: endpoint, dataType: 'jsonp'
} : {};
+
+ if ( !cachedPage ) {
+ cachedPage = $.Deferred().fail( function() {
+ delete cache[ pageTitle ];
+ } );
+ api.get( {
+ action: 'mobileview',
+ page: pageTitle,
+ variant: mw.config.get( 'wgPreferredVariant' ),
+ redirects: 'yes', prop: 'sections|text',
noheadings: 'yes',
+ noimages: mw.config.get( 'wgImagesDisabled',
false ) ? 1 : undefined,
+ sectionprop: 'level|line|anchor', sections:
leadOnly ? 0 : 'all'
+ }, options ).then( function( r ) {
+ if ( r.error || !r.mobileview.sections ) {
+ cachedPage.reject( r );
+ } else {
+ cachedPage.resolve( {
+ title: pageTitle,
+ sections: r.mobileview.sections,
+ isMainPage:
r.mobileview.hasOwnProperty( 'mainpage' ) ? true : false
+ } );
+ }
+ } ).fail( function( r ) {
+ cachedPage.reject( r );
+ } );
+ cache[ pageTitle ] = cachedPage;
+ }
+ return cachedPage;
+ }
+
+ /**
+ * Gathers a mapping of all available language codes on the site and
their human readable names
+ *
+ * @return {jQuery.Deferred} where argument is a javascript object with
language codes as keys
+ */
+ function retrieveAllLanguages() {
+ if ( !_languageCache ) {
+ _languageCache = api.get( {
+ action: 'query',
+ meta: 'siteinfo',
+ siprop: 'languages',
+ format: 'json'
+ } ).then( function( data ) {
+ var languages = {};
+ data.query.languages.forEach( function( item ) {
+ languages[ item.code ] = item[ '*' ];
+ } );
+ return languages;
+ } );
+ }
+ return _languageCache;
+ }
+
+ /**
+ * Retrieve available languages for a given title
+ *
+ * @param {Object} title the title of the page languages should be
retrieved for
+ * @param {Object} allAvailableLanguages a mapping of language codes to
language names
+ * @return {jQuery.Deferred} which is called with a mapping of language
codes to language names
+ */
+ function retrievePageLanguages( title, allAvailableLanguages ) {
+ return api.get( {
+ action: 'query',
+ prop: 'langlinks',
+ llurl: true,
+ lllimit: 'max',
+ titles: title
+ } ).then( function( resp ) {
+ // FIXME: API returns an object when a list makes much
more sense
+ var pages = $.map( resp.query.pages, function( v ) {
return v; } ),
+ // FIXME: "|| []" wouldn't be needed if API was
more consistent
+ langlinks = pages[0] ? pages[0].langlinks || []
: [];
+
+ langlinks.forEach( function( item, i ) {
+ langlinks[ i ].langname =
allAvailableLanguages[ item.lang ];
+ } );
+ return langlinks;
+ } );
+ }
+
return {
- getArticleUrl: getArticleUrl
+ getArticleUrl: getArticleUrl,
+ invalidateCachedPage: invalidateCachedPage,
+ retrievePage: retrievePage,
+ retrieveAllLanguages: retrieveAllLanguages,
+ retrievePageLanguages: retrievePageLanguages
};
}() );
diff --git a/javascripts/common/mf-application.js
b/javascripts/common/mf-application.js
index e1668f9..2f155c2 100644
--- a/javascripts/common/mf-application.js
+++ b/javascripts/common/mf-application.js
@@ -263,6 +263,17 @@
return sessionId;
}
+ function deParam( qs ) {
+ var params = {};
+ if ( qs ) {
+ qs.split( '&' ).forEach( function( p ) {
+ p = p.split( '=' );
+ params[ p[0] ] = p[1];
+ } );
+ }
+ return params;
+ }
+
$( init );
$.extend( M, {
@@ -282,7 +293,8 @@
prettyEncodeTitle: prettyEncodeTitle,
template: template,
unlockViewport: unlockViewport,
- router: new Router()
+ router: new Router(),
+ deParam: deParam
} );
}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/modules/uploads/lead-photo-init.js
b/javascripts/modules/uploads/lead-photo-init.js
index 5837ac9..9997858 100644
--- a/javascripts/modules/uploads/lead-photo-init.js
+++ b/javascripts/modules/uploads/lead-photo-init.js
@@ -38,7 +38,6 @@
isEditable = mw.config.get( 'wgIsPageEditable' ),
validNamespace = ( namespace === namespaceIds[''] ||
namespace === namespaceIds.user ),
$page = $( '#content' ),
- $pageHeading = $page.find( 'h1' ).first(),
optionsPhotoUploader,
photoUploader;
@@ -54,17 +53,12 @@
optionsPhotoUploader = {
buttonCaption: mw.msg( 'mobile-frontend-photo-upload' ),
insertInPage: true,
+ el: '#ca-upload',
pageTitle: mw.config.get( 'wgTitle' ),
funnel: funnel
};
- if ( $( '#ca-upload' ).length ) {
- optionsPhotoUploader.el = '#ca-upload';
- photoUploader = new PhotoUploaderPageActionButton(
optionsPhotoUploader );
- // FIXME: Remove else clause when page actions go to stable
- } else {
- photoUploader = new PhotoUploaderButton(
optionsPhotoUploader ).insertAfter( $pageHeading );
- }
+ photoUploader = new PhotoUploaderPageActionButton(
optionsPhotoUploader );
photoUploader.on( 'start', function() {
photoUploader.$el.hide();
} ).
diff --git a/less/common/mf-navigation.less b/less/common/mf-navigation.less
index fb04a74..0ea487b 100644
--- a/less/common/mf-navigation.less
+++ b/less/common/mf-navigation.less
@@ -11,21 +11,6 @@
@overlayBorderWidth: 1px;
@watchThisArticleSize: 22px;
-// FIXME: Remove when new nav goes to stable
-#mw-mf-menu-page {
- right: 0;
- list-style: none;
-
- li.watch-this-article,
- li.watch-this-article a {
- position: absolute;
- right: 0;
- top: 0;
- left: 0;
- bottom: 0;
- }
-}
-
// FIXME: Refactor when pageactions.less moves to stable
.watch-this-article {
background-image: url(images/watch.png);
diff --git a/less/common/pageactions.less b/less/common/pageactions.less
index 4160e73..aa97dbc 100644
--- a/less/common/pageactions.less
+++ b/less/common/pageactions.less
@@ -1,5 +1,7 @@
@import "../mf-mixins.less";
+// FIXME: hide in stable till talk code is stable
+.stable #ca-talk,
// hide menu items when not possible to use
.client-nojs #ca-watch.cta,
#ca-talk.selected {
@@ -7,7 +9,7 @@
}
#section_0 {
- margin: 10px @contentMarginRight 0 @contentMarginLeft;
+ margin: 14px @contentMarginRight 0 @contentMarginLeft;
padding-bottom: 9px;
border-bottom: dotted 1px #CACACA;
}
diff --git a/less/common/ui.less b/less/common/ui.less
index 852ae5d..750633e 100644
--- a/less/common/ui.less
+++ b/less/common/ui.less
@@ -23,6 +23,11 @@
}
}
+// FIXME: Delete when Echo moves to stable
+.stable .header {
+ padding-right: 10px;
+}
+
/* Menu buttons */
#mw-mf-menu-page,
#mw-mf-main-menu-button,
@@ -34,6 +39,11 @@
top: 0;
}
+// FIXME: hide Echo Notifications button in stable
+.stable #user-button {
+ display: none;
+}
+
/* hamburger */
// FIXME: make consistent with user-button
#mw-mf-main-menu-button {
diff --git a/less/common/user.less b/less/common/user.less
index a1109bf..0847e9a 100644
--- a/less/common/user.less
+++ b/less/common/user.less
@@ -23,3 +23,4 @@
}
}
}
+
diff --git a/less/mf-variables.less b/less/mf-variables.less
index 27e4197..d4ab920 100644
--- a/less/mf-variables.less
+++ b/less/mf-variables.less
@@ -10,8 +10,7 @@
@watchStarSize: 22px;
// FIXME: rename to contentMargin and remove one of those, they're always the
same
-// FIXME: when page actions move to stable, reduce slightly (May suggested
16px)
-@contentMarginRight: 23px;
+@contentMarginRight: 16px;
@contentMarginLeft: @contentMarginRight;
// information messages, e.g. empty watchlist message
@infoMargin: 4em;
diff --git a/less/modules/mf-toggle.less b/less/modules/mf-toggle.less
index 3eb5d4e..e4edeb6 100644
--- a/less/modules/mf-toggle.less
+++ b/less/modules/mf-toggle.less
@@ -9,33 +9,19 @@
}
.client-js {
- .alpha, .beta {
- .section_heading {
- position: relative;
- background: url(images/show.png) left 1.1em no-repeat;
- .background-size( 15px, auto );
- padding-left: 24px;
- padding-right: 0;
- &.openSection {
- padding-right: @sectionIconWidth + 15px;
- border-bottom: solid 1px @sectionBorderColor;
- margin-bottom: @headingMargin;
- }
- }
- }
-
- // FIXME: replace some rules with the above rules when editor in stable
.section_heading {
- background-image: url(images/show.png);
- background-position: right center;
- background-repeat: no-repeat;
- .background-size( auto, 9px );
- padding-right: 18px;
+ position: relative;
+ background: url(images/show.png) left 1.1em no-repeat;
+ .background-size( 15px, auto );
+ padding-left: 24px;
cursor: pointer;
&.openSection {
background-image: url(images/hide.png);
+ padding-right: @sectionIconWidth + 15px;
+ border-bottom: solid 1px @sectionBorderColor;
+ margin-bottom: @headingMargin;
}
}
diff --git a/stylesheets/common/drawer.css b/stylesheets/common/drawer.css
index fd0818f..c3f1a89 100644
--- a/stylesheets/common/drawer.css
+++ b/stylesheets/common/drawer.css
@@ -20,7 +20,7 @@
}
.drawer a.button {
display: block;
- margin: 1em 23px;
+ margin: 1em 16px;
}
.drawer a.signup {
display: block;
diff --git a/stylesheets/common/mf-enwp.css b/stylesheets/common/mf-enwp.css
index 789c3ee..4f900ea 100644
--- a/stylesheets/common/mf-enwp.css
+++ b/stylesheets/common/mf-enwp.css
@@ -111,7 +111,7 @@
max-width: 400px;
width: auto !important;
float: right !important;
- margin-left: 23px !important;
+ margin-left: 16px !important;
clear: right !important;
}
}
diff --git a/stylesheets/common/mf-footer.css b/stylesheets/common/mf-footer.css
index 3a6ff08..bd5d981 100644
--- a/stylesheets/common/mf-footer.css
+++ b/stylesheets/common/mf-footer.css
@@ -10,7 +10,7 @@
* See README.mediawiki for details on installing.
*/
#footer {
- padding: 2em 23px 1.5em 23px;
+ padding: 2em 16px 1.5em 16px;
margin: 2em 0 0;
border-top: 1px solid #aaa;
clear: both;
diff --git a/stylesheets/common/mf-navigation.css
b/stylesheets/common/mf-navigation.css
index c617f95..d70f6da 100644
--- a/stylesheets/common/mf-navigation.css
+++ b/stylesheets/common/mf-navigation.css
@@ -5,18 +5,6 @@
* Please edit the corresponding less file instead.
* See README.mediawiki for details on installing.
*/
-#mw-mf-menu-page {
- right: 0;
- list-style: none;
-}
-#mw-mf-menu-page li.watch-this-article,
-#mw-mf-menu-page li.watch-this-article a {
- position: absolute;
- right: 0;
- top: 0;
- left: 0;
- bottom: 0;
-}
.watch-this-article {
background-image: url(images/watch.png);
background-position: center center;
diff --git a/stylesheets/common/mf-typography.css
b/stylesheets/common/mf-typography.css
index 2b19cb2..6691c48 100644
--- a/stylesheets/common/mf-typography.css
+++ b/stylesheets/common/mf-typography.css
@@ -79,7 +79,7 @@
font-size: 0.75em;
}
.content {
- margin: 9pt 23px 0 23px;
+ margin: 9pt 16px 0 16px;
}
body.no-margins #content_wrapper > .content {
margin: 0;
diff --git a/stylesheets/common/overlays.css b/stylesheets/common/overlays.css
index 527efb8..8b123fa 100644
--- a/stylesheets/common/overlays.css
+++ b/stylesheets/common/overlays.css
@@ -103,7 +103,7 @@
}
.mw-mf-overlay .mw-mf-overlay-footer,
.mw-mf-overlay .mw-mf-overlay-header {
- padding: 4px 8px 4px 23px;
+ padding: 4px 8px 4px 16px;
margin: 0;
font-size: 0.8em;
color: #666;
diff --git a/stylesheets/common/pageactions.css
b/stylesheets/common/pageactions.css
index 3f1fd0e..2bd4fd7 100644
--- a/stylesheets/common/pageactions.css
+++ b/stylesheets/common/pageactions.css
@@ -5,17 +5,18 @@
* Please edit the corresponding less file instead.
* See README.mediawiki for details on installing.
*/
+.stable #ca-talk,
.client-nojs #ca-watch.cta,
#ca-talk.selected {
display: none;
}
#section_0 {
- margin: 10px 23px 0 23px;
+ margin: 14px 16px 0 16px;
padding-bottom: 9px;
border-bottom: dotted 1px #CACACA;
}
#page-actions {
- padding: 8px 23px 8px 15px;
+ padding: 8px 16px 8px 8px;
border-bottom: solid 1px #CACACA;
height: 30px;
}
diff --git a/stylesheets/common/pagelist.css b/stylesheets/common/pagelist.css
index 1b1f1a4..eb9926a 100644
--- a/stylesheets/common/pagelist.css
+++ b/stylesheets/common/pagelist.css
@@ -50,7 +50,7 @@
ul.page-list li .title {
display: block;
position: relative;
- padding: 0 23px 15px 23px;
+ padding: 0 16px 15px 16px;
margin: -1px 0;
/* FIXME: remove if we reset text-decoration in common styles */
diff --git a/stylesheets/common/ui.css b/stylesheets/common/ui.css
index 7e00e1b..705da69 100644
--- a/stylesheets/common/ui.css
+++ b/stylesheets/common/ui.css
@@ -360,6 +360,9 @@
font-size: 1.6em;
margin: 10px 0 0;
}
+.stable .header {
+ padding-right: 10px;
+}
/* Menu buttons */
#mw-mf-menu-page,
#mw-mf-main-menu-button,
@@ -370,6 +373,9 @@
position: absolute;
top: 0;
}
+.stable #user-button {
+ display: none;
+}
/* hamburger */
#mw-mf-main-menu-button {
background-image: url(images/menu/lowres/main.png);
diff --git a/stylesheets/modules/mf-photo.css b/stylesheets/modules/mf-photo.css
index b00f634..cab4e23 100644
--- a/stylesheets/modules/mf-photo.css
+++ b/stylesheets/modules/mf-photo.css
@@ -103,14 +103,14 @@
.photo-nag li {
clear: both;
min-height: 50px;
- padding: 0 0 1em 73px;
+ padding: 0 0 1em 66px;
line-height: 1.25;
}
.photo-nag label div {
float: left;
width: 50px;
height: 50px;
- margin: 0 0 0 -73px;
+ margin: 0 0 0 -66px;
font-size: 40px;
font-weight: bold;
line-height: 50px;
diff --git a/stylesheets/modules/mf-toggle.css
b/stylesheets/modules/mf-toggle.css
index d98b449..3bdd3bc 100644
--- a/stylesheets/modules/mf-toggle.css
+++ b/stylesheets/modules/mf-toggle.css
@@ -12,8 +12,7 @@
.content_block {
width: 100%;
}
-.client-js .alpha .section_heading,
-.client-js .beta .section_heading {
+.client-js .section_heading {
position: relative;
background: url(images/show.png) left 1.1em no-repeat;
/* use -webkit prefix for older android browsers eg. nexus 1 */
@@ -22,28 +21,13 @@
-webkit-background-size: 15px auto;
background-size: 15px auto;
padding-left: 24px;
- padding-right: 0;
-}
-.client-js .alpha .section_heading.openSection,
-.client-js .beta .section_heading.openSection {
- padding-right: 45px;
- border-bottom: solid 1px #e2e3e4;
- margin-bottom: 9pt;
-}
-.client-js .section_heading {
- background-image: url(images/show.png);
- background-position: right center;
- background-repeat: no-repeat;
- /* use -webkit prefix for older android browsers eg. nexus 1 */
-
- -o-background-size: auto 9px;
- -webkit-background-size: auto 9px;
- background-size: auto 9px;
- padding-right: 18px;
cursor: pointer;
}
.client-js .section_heading.openSection {
background-image: url(images/hide.png);
+ padding-right: 45px;
+ border-bottom: solid 1px #e2e3e4;
+ margin-bottom: 9pt;
}
.client-js a.section_anchors {
display: none;
diff --git a/stylesheets/modules/tutorials.css
b/stylesheets/modules/tutorials.css
index d6e7e16..92712f5 100644
--- a/stylesheets/modules/tutorials.css
+++ b/stylesheets/modules/tutorials.css
@@ -7,8 +7,8 @@
*/
/* Tutorial overlay styling */
.tutorial {
- padding-left: 23px;
- padding-right: 23px;
+ padding-left: 16px;
+ padding-right: 16px;
line-height: 1.4;
font-size: 0.9em;
background-color: #006398;
diff --git a/stylesheets/specials/uploads.css b/stylesheets/specials/uploads.css
index c136fce..7574e00 100644
--- a/stylesheets/specials/uploads.css
+++ b/stylesheets/specials/uploads.css
@@ -53,7 +53,7 @@
}
.carousel .slide.active {
visibility: visible;
- left: 23px;
+ left: 16px;
}
.carousel .slide p,
.carousel .slide strong {
@@ -116,7 +116,7 @@
}
ul.mobileUserGallery {
list-style: none;
- margin: 20px 23px 0 23px;
+ margin: 20px 16px 0 16px;
}
ul.mobileUserGallery li {
text-align: center;
--
To view, visit https://gerrit.wikimedia.org/r/73555
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7c1379874b115cf05ebd932b2f713d94062e08ee
Gerrit-PatchSet: 17
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits