From fcb138fc9528ba0393fc4b0295eeb0f30b1136dd Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sun, 30 Dec 2018 14:42:40 +0100 Subject: [PATCH] SpecialTags: Add and in the sortable table This avoids that module 'jquery.tablesorter' has to add the elements. With change I0b446d18f47428d8c0c4aed78b75de16fe106218 this also avoids a flash of missing sorting buttons while loading. Change-Id: If6368af27606ebdb6f8d6e3bbe742706ec45e4e6 --- includes/specials/SpecialTags.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index fd2d46a24b..fe8fa194b0 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -136,7 +136,7 @@ class SpecialTags extends SpecialPage { } // Write the headers - $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) . + $thead = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) . Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) . Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) . Xml::tags( 'th', null, $this->msg( 'tags-source-header' )->parse() ) . @@ -148,26 +148,28 @@ class SpecialTags extends SpecialPage { '' ) ); + $tbody = ''; // Used in #doTagRow() $this->softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), true ); // Insert tags that have been applied at least once foreach ( $tagStats as $tag => $hitcount ) { - $html .= $this->doTagRow( $tag, $hitcount, $userCanManage, + $tbody .= $this->doTagRow( $tag, $hitcount, $userCanManage, $userCanDelete, $userCanEditInterface ); } // Insert tags defined somewhere but never applied foreach ( $definedTags as $tag ) { if ( !isset( $tagStats[$tag] ) ) { - $html .= $this->doTagRow( $tag, 0, $userCanManage, $userCanDelete, $userCanEditInterface ); + $tbody .= $this->doTagRow( $tag, 0, $userCanManage, $userCanDelete, $userCanEditInterface ); } } $out->addHTML( Xml::tags( 'table', [ 'class' => 'mw-datatable sortable mw-tags-table' ], - $html + Xml::tags( 'thead', null, $thead ) . + Xml::tags( 'tbody', null, $tbody ) ) ); } -- 2.20.1