Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169606

Change subject: Restore the more button to the watchlist
......................................................................

Restore the more button to the watchlist

Bug: 71961
Change-Id: I4fd83e9cbad2326f9b6d47567638d35c75ecebb8
---
M includes/specials/SpecialMobileEditWatchlist.php
1 file changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/06/169606/1

diff --git a/includes/specials/SpecialMobileEditWatchlist.php 
b/includes/specials/SpecialMobileEditWatchlist.php
index 4b5c93d..4b41464 100644
--- a/includes/specials/SpecialMobileEditWatchlist.php
+++ b/includes/specials/SpecialMobileEditWatchlist.php
@@ -4,6 +4,15 @@
  */
 
 class SpecialMobileEditWatchlist extends SpecialEditWatchlist {
+       /**
+        * Construct function
+        */
+       public function __construct() {
+               $req = $this->getRequest();
+               $this->offset = $req->getVal( 'offset', 0 );
+               parent::__construct( 'EditWatchlist' );
+       }
+
        protected function outputSubtitle() {
                $user = $this->getUser();
                $this->getOutput()->addHtml( 
SpecialMobileWatchlist::getWatchlistHeader( $user ) );
@@ -75,6 +84,9 @@
                foreach ( $watchlist as $ns => $pages ) {
                        if ( $ns === NS_MAIN ) {
                                $html .= '<ul class="watchlist page-list 
thumbs">';
+                               $total = count( $pages );
+                               $pages = array_slice( $pages, $this->offset, 
SpecialMobileWatchlist::LIMIT );
+
                                foreach ( array_keys( $pages ) as $dbkey ) {
                                        $title = Title::makeTitleSafe( $ns, 
$dbkey );
                                        $thumb = '';
@@ -91,8 +103,19 @@
                                $html .= '</ul>';
                        }
                }
+               $newOffset = $this->offset + SpecialMobileWatchlist::LIMIT;
+
                if ( $total === 0 ) {
                        $html .= SpecialMobileWatchlist::getEmptyListHtml( 
false, $this->getLanguage() );
+               } else if ( $total  > $newOffset ) {
+                       // show button if there are more to show
+                       $qs = array( 'offset' => $newOffset );
+                       $html .= Html::element( 'a',
+                               array(
+                                       'class' => 'mw-ui-anchor 
mw-ui-progressive more',
+                                       'href' => SpecialPage::getTitleFor( 
'EditWatchlist' )->getLocalURL( $qs ),
+                               ),
+                               $this->msg( 'mobile-frontend-watchlist-more' ) 
);
                }
                $out = $this->getOutput();
                $out->addHtml( $html );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4fd83e9cbad2326f9b6d47567638d35c75ecebb8
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

Reply via email to