Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90454
Change subject: Story 1258: Move last modified to top of page
......................................................................
Story 1258: Move last modified to top of page
Don't do this for the main page
Show special colour when edit is recent.
Change-Id: I77dc8953a01c142d87dbf8ddbd4cab109baf578f
---
M includes/skins/MinervaTemplate.php
M includes/skins/MobileTemplateBeta.php
M includes/skins/SkinMobileBeta.php
M javascripts/modules/lastEdited/lastEditedBeta.js
M less/common/ui.less
5 files changed, 85 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/54/90454/1
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index 132e1c2..9efe3e7 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -112,6 +112,7 @@
/**
* Outputs the 'Last edited' message, e.g. 'Last edited on...'
* @param Array $data Data used to build the page
+ * @param Boolean $isAbove whether it appears at the bottom or top of
the page
*/
protected function renderHistoryLink( $data ) {
if ( isset( $data['historyLink'] ) ) {
@@ -122,8 +123,29 @@
}
}
+ protected function renderHistoryLinkBottom( $data ) {
+ $this->renderHistoryLink( $data );
+ }
+
protected function renderMetaSections() {
$this->renderLanguages();
+ }
+
+ protected function renderContent( $data ) {
+ if ( !$data[ 'unstyledContent' ] ) { ?>
+ <div id="content" class="content">
+ <?php
+ if ( isset( $data['subject-page'] ) ) {
+ echo $data['subject-page'];
+ }
+ echo $data[ 'bodytext' ];
+ $this->renderMetaSections();
+ $this->renderHistoryLinkBottom( $data );
+ ?>
+ </div>
+ <?php } else {
+ echo $data[ 'bodytext' ];
+ }
}
protected function renderContentWrapper( $data ) {
@@ -139,21 +161,8 @@
$this->renderPageActions( $data
);
}
}
+ $this->renderContent( $data );
?>
- <?php if ( !$data[ 'unstyledContent' ] ) { ?>
- <div id="content" class="content">
- <?php
- if ( isset( $data['subject-page'] ) ) {
- echo $data['subject-page'];
- }
- echo $data[ 'bodytext' ];
- $this->renderMetaSections();
- $this->renderHistoryLink( $data );
- ?>
- </div>
- <?php } else {
- echo $data[ 'bodytext' ];
- } ?>
</div>
<?php
}
diff --git a/includes/skins/MobileTemplateBeta.php
b/includes/skins/MobileTemplateBeta.php
index 2835630..2da70c4 100644
--- a/includes/skins/MobileTemplateBeta.php
+++ b/includes/skins/MobileTemplateBeta.php
@@ -5,4 +5,21 @@
parent::renderMetaSections();
echo Html::closeElement( 'div' );
}
+
+ protected function renderContentWrapper( $data ) {
+ $this->renderHistoryLinkTop( $data );
+ parent::renderContentWrapper( $data );
+ }
+
+ protected function renderHistoryLinkTop( $data ) {
+ if ( !$this->isMainPage ) {
+ $this->renderHistoryLink( $data );
+ }
+ }
+
+ protected function renderHistoryLinkBottom( $data ) {
+ if ( $this->isMainPage ) {
+ parent::renderHistoryLinkBottom( $data );
+ }
+ }
}
diff --git a/includes/skins/SkinMobileBeta.php
b/includes/skins/SkinMobileBeta.php
index e835ade..f3d492d 100644
--- a/includes/skins/SkinMobileBeta.php
+++ b/includes/skins/SkinMobileBeta.php
@@ -13,6 +13,18 @@
$out->addModuleStyles( 'mobile.styles.beta' );
}
+ public function prepareData( BaseTemplate $tpl ) {
+ parent::prepareData( $tpl );
+ // Move last modified link to top as long as it is not the main
page
+ $tpl->set( '_lastModifiedAbove',
!$this->getTitle()->isMainPage() );
+ }
+
+ protected function getHistoryLink( Title $title ) {
+ $link = parent::getHistoryLink( $title );
+ $link['class'] = 'top-bar';
+ return $link;
+ }
+
public function getSkinConfigVariables() {
$vars = parent::getSkinConfigVariables();
// force cta on in beta
diff --git a/javascripts/modules/lastEdited/lastEditedBeta.js
b/javascripts/modules/lastEdited/lastEditedBeta.js
index 5242924..1998ede 100644
--- a/javascripts/modules/lastEdited/lastEditedBeta.js
+++ b/javascripts/modules/lastEdited/lastEditedBeta.js
@@ -32,6 +32,7 @@
if ( ts ) {
delta = time.getTimeAgoDelta( parseInt( ts, 10 ) );
if ( time.isNow( delta ) ) {
+ $lastModified.addClass( 'active' );
args = args.concat( [
'mobile-frontend-last-modified-with-user-just-now', gender, username ] );
} else {
args = args.concat( [ keys[ delta.unit ],
gender, username,
@@ -45,6 +46,7 @@
username ? mw.util.wikiGetlink(
'Special:UserProfile/' + username ) : '' ] );
$( '<div>' ).attr( 'id', 'mw-mf-last-modified' ).
+ attr( 'class', $lastModified.attr( 'class' ) ).
html( mw.message.apply( this, args ).parse() ).
insertBefore( $lastModified );
$lastModified.remove();
diff --git a/less/common/ui.less b/less/common/ui.less
index aff3bf7..abe46a3 100644
--- a/less/common/ui.less
+++ b/less/common/ui.less
@@ -117,3 +117,34 @@
.content .edit-page {
display: none;
}
+
+// FIXME: Move to beta only place?
+.beta {
+ .top-bar {
+ background-color: #F3F3F3;
+ padding: 12px;
+ display: block;
+ color: #9C9C9C;
+ font-weight: bold;
+ text-transform: uppercase;
+ a {
+ color: #9C9C9C;
+ // If browser supports
+ &:nth-child(2) {
+ text-transform: none;
+ color: #1A1A1A;
+ }
+ }
+
+ &.active {
+ background-color: #00AF8B;
+ color: #fff;
+ a {
+ color: #fff;
+ &:nth-child(2) {
+ text-transform: uppercase;
+ }
+ }
+ }
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/90454
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77dc8953a01c142d87dbf8ddbd4cab109baf578f
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