Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64089
Change subject: Skin: Enable history link on desktop
......................................................................
Skin: Enable history link on desktop
Deprecate prepareTemplatePageContent
Move skin code to template code
Make common to mobile and desktop skin
Change-Id: I539ef6b540de46a238bb4360bb16d1bce3d150e4
---
M includes/skins/MinervaTemplate.php
M includes/skins/SkinMobile.php
2 files changed, 26 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/89/64089/1
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index 384f1f1..0b5954c 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -4,11 +4,32 @@
return wfMessage( 'mobile-frontend-placeholder' )->escaped();
}
- private function prepareCommonData() {
- // set defaults
- if ( !isset( $this->data['postbodytext'] ) ) {
- $this->set( 'postbodytext', '' ); // not set in desktop
skin
+ private function prepareHistoryLink() {
+ $sk = $this->getSkin();
+ $title = $sk->getTitle();
+ $isSpecialPage = $title->isSpecialPage();
+ $user = $sk->getUser();
+ $lang = $sk->getLanguage();
+
+ if ( $isSpecialPage ) {
+ $historyLink = '';
+ } else {
+ // add last modified timestamp
+ $timestamp = Revision::getTimestampFromId( $title,
$sk->getRevisionId() );
+ $lastModified = wfMessage(
'mobile-frontend-last-modified-date',
+ $lang->userDate( $timestamp, $user ),
$lang->userTime( $timestamp, $user ) )->parse();
+ $timestamp = wfTimestamp( TS_UNIX, $timestamp );
+ $historyUrl = wfExpandUrl(
$sk->getRequest()->appendQuery( 'action=history' ) );
+ $historyLink = Html::element( 'a', array(
+ 'id' => 'mw-mf-last-modified',
+ 'data-timestamp' => $timestamp,
+ 'href' => $historyUrl,
+ ), $lastModified );
}
+ $this->set( 'history', $historyLink );
+ }
+ private function prepareCommonData() {
+ $this->prepareHistoryLink();
$searchBox = $this->makeSearchInput(
array(
'id' => 'searchInput',
@@ -221,7 +242,7 @@
echo $data['talk'];
echo $data[ 'bodytext'
];
echo
$this->renderLanguages( $languageData );
- echo
$data['postbodytext'];
+ echo $data['history'];
?>
</div><!-- close #content -->
</div><!-- close #content_wrapper -->
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 93e7d82..d4f2e1e 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -41,7 +41,6 @@
$tpl->set( 'pagetitle', $out->getHTMLTitle() );
- $this->prepareTemplatePageContent( $tpl );
$this->prepareTemplateLinks( $tpl );
$this->prepareFooterLinks( $tpl );
@@ -160,37 +159,6 @@
return $ctx->getMobileUrl( $loginUrl,
$wgMFForceSecureLogin );
}
return SpecialPage::getTitleFor( 'UserLogin' )->getLocalURL(
$query );
- }
-
- /**
- * FIXME: migrate to MinervaTemplate / SkinMobileTemplate
- * Prepares the header and the content of a page
- * Stores in QuickTemplate prebodytext, postbodytext keys
- * @param QuickTemplate
- */
- function prepareTemplatePageContent( QuickTemplate $tpl ) {
- $title = $this->getTitle();
- $isSpecialPage = $title->isSpecialPage();
- $user = $this->getUser();
- $ctx = MobileContext::singleton();
-
- $postBodyText = '';
- if ( !$isSpecialPage ) {
- // add last modified timestamp
- $timestamp = Revision::getTimestampFromId(
$this->getTitle(), $this->getRevisionId() );
- $lastModified = wfMessage(
'mobile-frontend-last-modified-date',
- $this->getLanguage()->userDate( $timestamp,
$user ),
- $this->getLanguage()->userTime( $timestamp,
$user )
- )->parse();
- $timestamp = wfTimestamp( TS_UNIX, $timestamp );
- $historyUrl = $ctx->getMobileUrl( wfExpandUrl(
$this->getRequest()->appendQuery( 'action=history' ) ) );
- $postBodyText = Html::element( 'a', array(
- 'id' => 'mw-mf-last-modified',
- 'data-timestamp' => $timestamp,
- 'href' => $historyUrl
- ), $lastModified );
- }
- $tpl->set( 'postbodytext', $postBodyText );
}
protected function attachResources( Title $title, QuickTemplate $tpl,
IDeviceProperties $device ) {
--
To view, visit https://gerrit.wikimedia.org/r/64089
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I539ef6b540de46a238bb4360bb16d1bce3d150e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits