jenkins-bot has submitted this change and it was merged.

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, 94 insertions(+), 14 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 84a522a..17696a2 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -117,8 +117,37 @@
                }
        }
 
+       /**
+        * Renders history link at top of page
+        * @param Array $data Data used to build the page
+        */
+       protected function renderHistoryLinkBottom( $data ) {
+               $this->renderHistoryLink( $data );
+       }
+
        protected function renderMetaSections() {
                $this->renderLanguages();
+       }
+
+       /**
+        * Renders the content of a page
+        * @param Array $data Data used to build the page
+        */
+       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 ) {
@@ -134,21 +163,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..e1d496e 100644
--- a/includes/skins/MobileTemplateBeta.php
+++ b/includes/skins/MobileTemplateBeta.php
@@ -1,8 +1,32 @@
 <?php
 class MobileTemplateBeta extends MobileTemplate {
+       protected $isMainPage;
+
+       public function execute() {
+               $this->isMainPage = $this->getSkin()->getTitle()->isMainPage();
+               parent::execute();
+       }
+
        protected function renderMetaSections() {
                echo Html::openElement( 'div', array( 'id' => 
'page-secondary-actions' ) );
                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..29ea672 100644
--- a/less/common/ui.less
+++ b/less/common/ui.less
@@ -117,3 +117,29 @@
 .content .edit-page {
        display: none;
 }
+
+// FIXME: Move to beta/alpha only place?
+.alpha,
+.beta {
+       .top-bar {
+               background-color: #F3F3F3;
+               padding: 8px;
+               display: block;
+               color: #9C9C9C;
+               a {
+                       color: #9C9C9C;
+                       // If browser supports
+                       &:nth-child(2) {
+                               font-weight: bold;
+                       }
+               }
+
+               &.active {
+                       background-color: #00AF8B;
+                       color: #fff;
+                       a {
+                               color: #fff;
+                       }
+               }
+       }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/90454
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I77dc8953a01c142d87dbf8ddbd4cab109baf578f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to