Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Add a link to Special:GatherLists to view hidden lists
......................................................................

Add a link to Special:GatherLists to view hidden lists

Actually you need to manually add "hidden" as a subpage to Special:GatherLists
to view hidden lists. Add a link as a subtitle to Special:GatherLists to make
this a lot easier. Add a backlink to show only visible lists, too, when
Special:GatherLists/hidden is shown.

Change-Id: Ibc94f46bfea73f9d3e76117f8d8ec1ce60e77206
---
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialGatherLists.php
3 files changed, 26 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/11/200511/1

diff --git a/i18n/en.json b/i18n/en.json
index 1d26909..e0c6c49 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,6 +7,8 @@
                        "Yuri Astrakhan"
                ]
        },
+       "gather-lists-showhidden": "Show hidden lists",
+       "gather-lists-showvisible": "Show visible lists",
        "gather-lists-collection-owner": "Owner",
        "gather-lists-collection-last-updated": "Last updated",
        "gather-lists-collection-title": "Title",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f60ae28..71b352d 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -12,6 +12,8 @@
                        "Yurik"
                ]
        },
+       "gather-lists-showhidden": "Link title to show hidden lists on 
[[Special:GatherLists]].",
+       "gather-lists-showvisible": "Link title to show visible lists on 
[[Special:GatherLists]].",
        "gather-lists-collection-owner": "Label for owner of collection on list 
of all collections\n{{Identical|Owner}}",
        "gather-lists-collection-last-updated": "Label for last updated time of 
a collection\n{{Identical|Last updated}}",
        "gather-lists-collection-title": "Label for title of collection on list 
of all collections\n{{Identical|Title}}",
diff --git a/includes/specials/SpecialGatherLists.php 
b/includes/specials/SpecialGatherLists.php
index 555ce11..1663716 100644
--- a/includes/specials/SpecialGatherLists.php
+++ b/includes/specials/SpecialGatherLists.php
@@ -10,6 +10,7 @@
 use ApiMain;
 use FauxRequest;
 use Html;
+use Linker;
 use Gather\views\helpers\CSS;
 use MWTimestamp;
 
@@ -46,9 +47,15 @@
         * Render the special page
         */
        public function execute( $subPage ) {
-               if ( $subPage === 'hidden' && !$this->canHideLists() ) {
-                       $this->renderError();
-                       return;
+               $out = $this->getOutput();
+               if ( $subPage === 'hidden' ) {
+                       if ( !$this->canHideLists() ) {
+                               $this->renderError();
+                               return;
+                       }
+                       $out->addSubtitle( $this->getSubTitle() );
+               } else {
+                       $out->addSubtitle( $this->getSubTitle( true ) );
                }
                // FIXME: Make method on CollectionsList
                $api = new ApiMain( new FauxRequest( array(
@@ -69,6 +76,18 @@
        }
 
        /**
+        * Get subtitle text with a link to show the (un-)hidden collections.
+        * @param boolean $hidden Whether to get a link to show the hidden 
collections
+        * @return string
+        */
+       public function getSubTitle( $hidden = false ) {
+               return Linker::link(
+                       SpecialPage::getTitleFor( 'GatherLists', ( $hidden ? 
'hidden' : false ) ),
+                       ( $hidden ? $this->msg( 'gather-lists-showhidden' ) : 
$this->msg( 'gather-lists-showvisible' ) )
+               );
+       }
+
+       /**
         * Render the special page
         *
         * @param array $lists

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc94f46bfea73f9d3e76117f8d8ec1ce60e77206
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to