Make legend table collapsed.

Change-Id: Ic545b20a51e2a039225e99ea178c099ab2db012b
This commit is contained in:
Siebrand Mazeland 2012-05-21 15:29:32 +02:00
parent 49583759df
commit c67fe8aff9
4 changed files with 37 additions and 14 deletions

View file

@ -35,3 +35,7 @@ input#mw-interwiki-url {
.mw-interwikitable-modify {
white-space: nowrap;
}
.mw-special-Interwiki .mw-collapsible-toggle {
float: left;
}

View file

@ -29,7 +29,9 @@ $messages['en'] = array(
'interwiki' => 'View and edit interwiki data',
'interwiki-title-norights' => 'View interwiki data',
'interwiki-desc' => 'Adds a [[Special:Interwiki|special page]] to view and edit the interwiki table',
'interwiki_intro' => 'This is an overview of the interwiki table. Meanings of the data in the columns:',
'interwiki_intro' => 'This is an overview of the interwiki table.',
'interwiki-legend-show' => 'Show legend',
'interwiki-legend-hide' => 'Hide legend',
'interwiki_prefix' => 'Prefix',
'interwiki-prefix-label' => 'Prefix:',
'interwiki_prefix_intro' => 'Interwiki prefix to be used in <code>[<nowiki />[prefix:<i>pagename</i>]]</code> wikitext syntax.',
@ -112,6 +114,8 @@ $messages['qqq'] = array(
'interwiki-title-norights' => 'Part of the interwiki extension. This message is the title of the special page [[Special:Interwiki]] when the user has no right to edit the interwiki data, so can only view them.',
'interwiki-desc' => '{{desc}}',
'interwiki_intro' => 'Part of the interwiki extension. Shown as introductory text on [[Special:Interwiki]].',
'interwiki-legend-show' => 'Link text for toggle to display the legend on [[Special:Interwiki]].',
'interwiki-legend-hide' => 'Link text for toggle to hide the legend on [[Special:Interwiki]].',
'interwiki_prefix' => 'Used on [[Special:Interwiki]] as a column header of the table.',
'interwiki-prefix-label' => 'Used on [[Special:Interwiki]] as a field label in a form.',
'interwiki_prefix_intro' => 'Used on [[Special:Interwiki]] so as to explain the data in the {{msg-mw|interwiki_prefix}} column of the table.

View file

@ -38,10 +38,13 @@ $wgExtensionCredits['specialpage'][] = array(
$wgExtensionFunctions[] = 'setupInterwikiExtension';
$wgResourceModules['SpecialInterwiki'] = array(
$wgResourceModules['ext.interwiki.specialpage'] = array(
'styles' => 'Interwiki.css',
'localBasePath' => dirname( __FILE__ ),
'remoteExtPath' => 'Interwiki',
'dependencies' => array(
'jquery.makeCollapsible',
),
);
// Set up the new special page

View file

@ -32,7 +32,7 @@ class SpecialInterwiki extends SpecialPage {
$out = $this->getOutput();
$request = $this->getRequest();
$out->addModuleStyles( 'SpecialInterwiki' );
$out->addModules( 'ext.interwiki.specialpage' );
$action = $par ? $par : $request->getVal( 'action', $par );
$return = $this->getTitle();
@ -249,21 +249,33 @@ class SpecialInterwiki extends SpecialPage {
$canModify = $this->canModify();
$this->getOutput()->addWikiMsg( 'interwiki_intro' );
// Make collapsible.
$this->getOutput()->addHTML(
Html::rawElement( 'table', array( 'class' => 'mw-interwikitable wikitable intro' ),
self::addInfoRow( 'start', 'interwiki_prefix', 'interwiki_prefix_intro' ) .
self::addInfoRow( 'start', 'interwiki_url', 'interwiki_url_intro' ) .
self::addInfoRow( 'start', 'interwiki_local', 'interwiki_local_intro' ) .
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_local_0_intro' ) .
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_local_1_intro' ) .
self::addInfoRow( 'start', 'interwiki_trans', 'interwiki_trans_intro' ) .
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_trans_0_intro' ) .
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_trans_1_intro' )
) . "\n"
Html::openElement(
'div', array(
'class' => 'mw-collapsible mw-collapsed',
'data-collapsetext' => $this->msg( 'interwiki-legend-hide' )->escaped(),
'data-expandtext' => $this->msg('interwiki-legend-show' )->escaped()
) ) );
$this->getOutput()->addHTML(
Html::rawElement(
'table', array( 'class' => 'mw-interwikitable wikitable intro' ),
self::addInfoRow( 'start', 'interwiki_prefix', 'interwiki_prefix_intro' ) . "\n" .
self::addInfoRow( 'start', 'interwiki_url', 'interwiki_url_intro' ) . "\n" .
self::addInfoRow( 'start', 'interwiki_local', 'interwiki_local_intro' ) . "\n" .
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_local_0_intro' ) . "\n" .
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_local_1_intro' ) . "\n" .
self::addInfoRow( 'start', 'interwiki_trans', 'interwiki_trans_intro' ) . "\n" .
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_trans_0_intro' ) . "\n" .
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_trans_1_intro' ) . "\n"
)
);
$this->getOutput()->addHTML( Html::closeElement( 'table' ) );
$this->getOutput()->addHTML( Html::closeElement( 'div' ) ); // end collapsible.
if ( $canModify ) {
$this->getOutput()->addWikiMsg( 'interwiki_intro_footer' );
$this->getOutput()->addHTML( "<br />" . $this->msg( 'interwiki_intro_footer' )->parse() );
$addtext = $this->msg( 'interwiki_addtext' )->escaped();
$addlink = Linker::linkKnown( $this->getTitle( 'add' ), $addtext );
$this->getOutput()->addHTML( '<p class="mw-interwiki-addlink">' . $addlink . '</p>' );