Jdlrobson has submitted this change and it was merged.
Change subject: Code move: Lift and shift html rendering to MinervaTemplate
......................................................................
Code move: Lift and shift html rendering to MinervaTemplate
1-1 mapping, plus render methods private/public -> protected
Change-Id: I9b4f41c96a9b497634b71c889bf7628c44ad5be7
---
M includes/skins/MinervaTemplate.php
M includes/skins/SkinMobileTemplate.php
2 files changed, 54 insertions(+), 66 deletions(-)
Approvals:
awjrichards: Verified; Looks good to me, approved
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index f6d9451..4da10d5 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -69,7 +69,7 @@
return $this->data['language_urls'];
}
- public function renderLanguages( $languageTemplateData ) {
+ protected function renderLanguages( $languageTemplateData ) {
if ( $languageTemplateData['languages'] && count(
$languageTemplateData['languages'] ) > 0 ) {
?>
<div class="section" id="mw-mf-language-section">
@@ -97,7 +97,39 @@
}
}
- private function render( $data ) { // FIXME: replace with template
engines
+ protected function renderFooter( $data ) {
+ if ( !$data['isSpecialPage'] ) {
+ ?>
+ <div id="footer">
+ <h2 id="section_footer">
+ <?php $this->html( 'sitename' ); ?>
+ </h2>
+ <div id="content_footer">
+ <?php
+ foreach( $this->getFooterLinks() as $category => $links
):
+ ?>
+ <ul class="footer-<?php echo $category; ?>">
+ <?php foreach( $links as $link ): ?><li
id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html(
$link ) ?></li><?php endforeach; ?>
+ </ul>
+ <?php endforeach; ?>
+ </div>
+ </div>
+ <?php
+ }
+ }
+
+ protected function render( $data ) { // FIXME: replace with template
engines
+ $languages = $this->getLanguages();
+ $variants = $this->getLanguageVariants();
+ $languageData = array(
+ 'heading' => wfMessage(
'mobile-frontend-language-article-heading' )->text(),
+ 'languages' => $languages,
+ 'variants' => $variants,
+ 'languageSummary' => wfMessage(
'mobile-frontend-language-header', count( $languages ) )->text(),
+ 'variantSummary' => count( $variants ) > 1 ? wfMessage(
'mobile-frontend-language-variant-header' )->text() : '',
+ );
+
+ // begin rendering
echo $data[ 'headelement' ];
?>
<div id="mw-mf-viewport">
@@ -126,6 +158,26 @@
<ul id="mw-mf-menu-page">
</ul>
</div>
+ <div class='show' id='content_wrapper'>
+ <div id="content" class="content">
+ <?php
+ echo
$data['prebodytext'];
+ echo $data[ 'bodytext'
];
+ echo
$this->renderLanguages( $languageData );
+ echo
$data['postbodytext'];
+ ?>
+ </div><!-- close #content -->
+ </div><!-- close #content_wrapper -->
+ <?php
+ echo $this->renderFooter( $data );
+ ?>
+ </div><!-- close #mw-mf-page-center -->
+ </div><!-- close #mw-mf-viewport -->
+ <?php
+ echo $data['bottomScripts'];
+ ?>
+ </body>
+ </html>
<?php
}
}
diff --git a/includes/skins/SkinMobileTemplate.php
b/includes/skins/SkinMobileTemplate.php
index 6927a98..5c631c5 100644
--- a/includes/skins/SkinMobileTemplate.php
+++ b/includes/skins/SkinMobileTemplate.php
@@ -30,51 +30,6 @@
parent::__construct();
}
- public function renderArticleSkin() {
- $languages = $this->getLanguages();
- $variants = $this->getLanguageVariants();
- $languageData = array(
- 'heading' => wfMessage(
'mobile-frontend-language-article-heading' )->text(),
- 'languages' => $languages,
- 'variants' => $variants,
- 'languageSummary' => wfMessage(
'mobile-frontend-language-header', count( $languages ) )->text(),
- 'variantSummary' => count( $variants ) > 1 ? wfMessage(
'mobile-frontend-language-variant-header' )->text() : '',
- );
- ?>
- <div class='show' id='content_wrapper'>
- <div id="content" class="content">
- <?php
- $this->html( 'prebodytext' );
- $this->html( 'bodytext' );
- $this->renderLanguages( $languageData );
- $this->html( 'postbodytext' );
- ?>
- </div><!-- close #content -->
- </div><!-- close #content_wrapper -->
- <?php
- if ( !$this->data[ 'isSpecialPage' ] ) {
- $this->footer();
- } ?>
- <?php
- $this->navigationEnd();
- }
-
- public function execute() {
- parent::execute();
- $this->renderArticleSkin();
- $this->html( 'bottomScripts' ) ?>
- </body>
- </html><?php
- }
-
- public function navigationEnd() {
- //close #mw-mf-page-center then viewport;
- ?>
- </div><!-- close #mw-mf-page-center -->
- </div><!-- close #mw-mf-viewport -->
- <?php
- }
-
public function prepareData() {
global $wgExtensionAssetsPath,
$wgMobileFrontendLogo;
@@ -88,25 +43,6 @@
$this->set( 'header', $data['specialPageHeader'] );
}
wfProfileOut( __METHOD__ );
- }
-
- private function footer() {
- ?>
- <div id="footer">
- <h2 id="section_footer">
- <?php $this->html( 'sitename' ); ?>
- </h2>
- <div id="content_footer">
- <?php
- foreach( $this->getFooterLinks() as $category => $links
):
- ?>
- <ul class="footer-<?php echo $category; ?>">
- <?php foreach( $links as $link ): ?><li
id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html(
$link ) ?></li><?php endforeach; ?>
- </ul>
- <?php endforeach; ?>
- </div>
- </div>
- <?php
}
public function getPersonalTools() {
--
To view, visit https://gerrit.wikimedia.org/r/58996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9b4f41c96a9b497634b71c889bf7628c44ad5be7
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits