MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/115978
Change subject: [Card 703] Promote lazy languages to stable ...................................................................... [Card 703] Promote lazy languages to stable Change-Id: I035c07ebc4ca17153e8480690762c73cc5d89f8d --- M includes/Resources.php M includes/skins/MinervaTemplate.php M includes/skins/MinervaTemplateBeta.php M includes/skins/SkinMinervaBeta.php M includes/specials/SpecialMobileLanguages.php R javascripts/modules/languages/languages.js D javascripts/modules/languages/languagesStable.js D templates/languageSection.html 8 files changed, 16 insertions(+), 152 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/78/115978/1 diff --git a/includes/Resources.php b/includes/Resources.php index 785fde9..8a8e834 100644 --- a/includes/Resources.php +++ b/includes/Resources.php @@ -244,8 +244,6 @@ 'templates' => array( 'page', 'section', - // FIXME: Remove when lazy loaded languages go to stable - 'languageSection', ), 'scripts' => array( 'javascripts/common/Router.js', @@ -862,12 +860,13 @@ ), ), - 'mobile.languages.common' => $wgMFMobileResourceBoilerplate + array( + 'mobile.languages' => $wgMFMobileResourceBoilerplate + array( 'dependencies' => array( 'mobile.overlays', ), 'scripts' => array( 'javascripts/modules/languages/LanguageOverlay.js', + 'javascripts/modules/languages/languages.js', ), 'templates' => array( 'modules/languages/LanguageOverlay', @@ -877,24 +876,6 @@ 'mobile-frontend-language-header', 'mobile-frontend-language-variant-header' => array( 'parse' ), 'mobile-frontend-language-site-choose', - ), - ), - - 'mobile.languages' => $wgMFMobileResourceBoilerplate + array( - 'dependencies' => array( - 'mobile.languages.common', - ), - 'scripts' => array( - 'javascripts/modules/languages/languagesStable.js', - ), - ), - - 'mobile.languages.beta' => $wgMFMobileResourceBoilerplate + array( - 'dependencies' => array( - 'mobile.languages.common', - ), - 'scripts' => array( - 'javascripts/modules/languages/languagesBeta.js', ), ), diff --git a/includes/skins/MinervaTemplate.php b/includes/skins/MinervaTemplate.php index 39e1369..3ba7189 100644 --- a/includes/skins/MinervaTemplate.php +++ b/includes/skins/MinervaTemplate.php @@ -39,50 +39,6 @@ return $this->data['footerlinks']; } - protected function renderLanguages() { - $languages = $this->getLanguages(); - $variants = $this->getLanguageVariants(); - // stupid php: count( false ) returns 1 - $languagesCount = is_array( $languages ) ? count( $languages ) : 0; - $variantsCount = is_array( $variants ) ? count( $variants ) : 0; - - if ( $languagesCount > 0 || $variantsCount > 1 ) { - $heading = wfMessage( 'mobile-frontend-language-article-heading' )->text(); - $languageSummary = wfMessage( 'mobile-frontend-language-header', $languagesCount )->text(); - $variantSummary = $variantsCount > 1 ? wfMessage( 'mobile-frontend-language-variant-header' )->text() : ''; - ?> - <div class="section" id="mw-mf-language-section"> - <h2 id="section_language" class="section_heading"><?php echo $heading; ?></h2> - <div id="content_language" class="content_block"> - - <?php if ( $variantsCount > 1 ) { ?> - <p id="mw-mf-language-variant-header"><?php echo $variantSummary; ?></p> - <ul id="mw-mf-language-variant-selection"> - <?php - foreach( $variants as $key => $val ): - echo $this->makeListItem( $key, $val ); - endforeach; - ?> - </ul> - <?php } ?> - - <?php if ( $languagesCount > 0 ) { ?> - <p id="mw-mf-language-header"><?php echo $languageSummary; ?></p> - <ul id="mw-mf-language-selection"> - <?php - foreach( $languages as $key => $val ): - echo $this->makeListItem( $key, $val ); - endforeach; - ?> - </ul> - <?php } ?> - - </div> - </div> - <?php - } - } - protected function renderFooter( $data ) { if ( !$data['disableSearchAndFooter'] ) { ?> @@ -129,7 +85,20 @@ } protected function renderMetaSections() { - $this->renderLanguages(); + echo Html::openElement( 'div', array( 'id' => 'page-secondary-actions' ) ); + + // If languages are available, render a languages link + if ( $this->getLanguages() || $this->getLanguageVariants() ) { + $languageUrl = SpecialPage::getTitleFor( 'MobileLanguages', $this->getSkin()->getTitle() )->getLocalURL(); + $languageLabel = wfMessage( 'mobile-frontend-language-article-heading' )->text(); + + echo Html::element( 'a', array( + 'class' => 'mw-ui-button mw-ui-progressive button languageSelector', + 'href' => $languageUrl + ), $languageLabel ); + } + + echo Html::closeElement( 'div' ); } /** diff --git a/includes/skins/MinervaTemplateBeta.php b/includes/skins/MinervaTemplateBeta.php index dc56ed8..6cc0b54 100644 --- a/includes/skins/MinervaTemplateBeta.php +++ b/includes/skins/MinervaTemplateBeta.php @@ -13,23 +13,6 @@ } } - protected function renderMetaSections() { - echo Html::openElement( 'div', array( 'id' => 'page-secondary-actions' ) ); - - // If languages are available, render a languages link - if ( $this->getLanguages() || $this->getLanguageVariants() ) { - $languageUrl = SpecialPage::getTitleFor( 'MobileLanguages', $this->getSkin()->getTitle() )->getLocalURL(); - $languageLabel = wfMessage( 'mobile-frontend-language-article-heading' )->text(); - - echo Html::element( 'a', array( - 'class' => 'mw-ui-button mw-ui-progressive button languageSelector', - 'href' => $languageUrl - ), $languageLabel ); - } - - echo Html::closeElement( 'div' ); - } - protected function renderContentWrapper( $data ) { $this->renderHistoryLinkTop( $data ); parent::renderContentWrapper( $data ); diff --git a/includes/skins/SkinMinervaBeta.php b/includes/skins/SkinMinervaBeta.php index fea316f..d6b22d6 100644 --- a/includes/skins/SkinMinervaBeta.php +++ b/includes/skins/SkinMinervaBeta.php @@ -60,7 +60,6 @@ $modules['mobile'][] = 'mobile.head.beta'; $modules['beta'] = array( 'mobile.beta' ); $modules['beta'][] = 'mobile.geonotahack'; - $modules['languages'] = array( 'mobile.languages.beta' ); $modules['toggling'] = array( 'mobile.toggling.beta' ); // turn off stable only modules $modules['stableonly'] = array(); diff --git a/includes/specials/SpecialMobileLanguages.php b/includes/specials/SpecialMobileLanguages.php index 4d74714..27f3a97 100755 --- a/includes/specials/SpecialMobileLanguages.php +++ b/includes/specials/SpecialMobileLanguages.php @@ -1,7 +1,6 @@ <?php class SpecialMobileLanguages extends MobileSpecialPage { - protected $mode = 'beta'; /** @var Title */ private $title; diff --git a/javascripts/modules/languages/languagesBeta.js b/javascripts/modules/languages/languages.js similarity index 100% rename from javascripts/modules/languages/languagesBeta.js rename to javascripts/modules/languages/languages.js diff --git a/javascripts/modules/languages/languagesStable.js b/javascripts/modules/languages/languagesStable.js deleted file mode 100644 index db94993..0000000 --- a/javascripts/modules/languages/languagesStable.js +++ /dev/null @@ -1,56 +0,0 @@ -// FIXME: remove this file and mobile.languages.stable module when dynamic -// loading of languages goes to stable -( function( M, $ ) { - var LanguageOverlay = M.require( 'languages/LanguageOverlay' ), - variants, languages; - - M.overlayManager.add( /^\/languages$/, function() { - return new LanguageOverlay( { - languages: languages, - variants: variants - } ); - } ); - - /** - * Takes a list of languages and transforms them into an array for use in a LanguageOverlay - * - * @returns {Array} - */ - function parseList( $list ) { - var list = []; - $list.find( 'li' ).each( function() { - var $a = $( this ).find( 'a' ), lang, pageName = $a.attr( 'title' ); - - lang = { lang: $a.attr( 'lang' ), langname: $a.text(), url: $a.attr( 'href' ) }; - if ( pageName ) { - lang.pageName = pageName; - } - list.push( lang ); - } ); - return list; - } - - function initButton() { - var $section = $( '#mw-mf-language-section' ), - $h2 = $section.find( 'h2' ); - - languages = parseList( $section.find( '#mw-mf-language-selection' ) ); - variants = parseList( $section.find( '#mw-mf-language-variant-selection' ) ); - - // assume the current language is not present - if ( languages.length > 0 || variants.length > 1 ) { - $( '<button>' ).text( $h2.text() ). - addClass( 'languageSelector' ). - on( 'click', function() { - M.router.navigate( '/languages' ); - } ).insertBefore( $section ); - } - $section.remove(); - } - - $( initButton ); - M.on( 'page-loaded', initButton ); - - M.define( 'modules/languages/languagesStable', { parseList: parseList } ); - -}( mw.mobileFrontend, jQuery ) ); diff --git a/templates/languageSection.html b/templates/languageSection.html deleted file mode 100644 index bff66b7..0000000 --- a/templates/languageSection.html +++ /dev/null @@ -1,11 +0,0 @@ -<h2 id="section_language" class="section_heading">{{heading}}</h2> -<div id="content_language"> - <p id="mw-mf-language-header">{{description}}</p> - <ul id="mw-mf-language-selection"> - {{#langlinks}} - <li> - <a href="{{url}}" hreflang="{{lang}}" lang="{{lang}}" title="{{*}}">{{langname}}</a> - </li> - {{/langlinks}} - </ul> -</div> -- To view, visit https://gerrit.wikimedia.org/r/115978 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I035c07ebc4ca17153e8480690762c73cc5d89f8d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits