Special:Allpages replace table with unordered list
authorDanny B <danny.b@email.cz>
Sat, 12 Jul 2014 11:34:30 +0000 (13:34 +0200)
committerDanny B <danny.b@email.cz>
Sat, 12 Jul 2014 11:34:30 +0000 (13:34 +0200)
* better accessibility
* better customizability
* less output html code

Change-Id: I99b3ad5f94fdc3dfa0f2f9935e1bb00808d2fece

includes/specials/SpecialAllPages.php
resources/src/mediawiki.special/mediawiki.special.css

index e4b606d..3d68a78 100644 (file)
@@ -213,32 +213,20 @@ class SpecialAllPages extends IncludableSpecialPage {
                        );
 
                        if ( $res->numRows() > 0 ) {
-                               $out = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-chunk' ) );
+                               $out = Xml::openElement( 'ul', array( 'class' => 'mw-allpages-chunk' ) );
                                while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                        $t = Title::newFromRow( $s );
                                        if ( $t ) {
-                                               $link = ( $s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
+                                               $out .= '<li' .
+                                                       ( $s->page_is_redirect ? ' class="allpagesredirect"' : '' ) .
+                                                       '>' .
                                                        Linker::link( $t ) .
-                                                       ( $s->page_is_redirect ? '</div>' : '' );
+                                                       "</li>\n";
                                        } else {
-                                               $link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
+                                               $out .= '<li>[[' . htmlspecialchars( $s->page_title ) . "]]</li>\n";
                                        }
-
-                                       if ( $n % 3 == 0 ) {
-                                               $out .= '<tr>';
-                                       }
-
-                                       $out .= "<td style=\"width:33%\">$link</td>";
-                                       $n++;
-                                       if ( $n % 3 == 0 ) {
-                                               $out .= "</tr>\n";
-                                       }
-                               }
-
-                               if ( ( $n % 3 ) != 0 ) {
-                                       $out .= "</tr>\n";
                                }
-                               $out .= Xml::closeElement( 'table' );
+                               $out .= Xml::closeElement( 'ul' );
                        } else {
                                $out = '';
                        }
index 7ac8154..0356fc7 100644 (file)
 }
 
 /* Special:Allpages */
-table.mw-allpages-table-form, table.mw-allpages-table-chunk {
+table.mw-allpages-table-form {
        width: 100%;
 }
+table.mw-allpages-table-form tr {
+       vertical-align: top;
+}
 .mw-allpages-nav {
        text-align: right;
        margin-bottom: 1em;
 }
-table.mw-allpages-table-form tr {
+
+ul.mw-allpages-chunk {
+       margin: 0;
+       padding: 0;
+}
+ul.mw-allpages-chunk li {
+       border-top: 1px solid #ccc;
+       display: inline-block;
+       margin: 0 1% 0 0;
+       padding: .2em 0;
        vertical-align: top;
+       width: 31%;
 }
 
 /* Special:BlockList */