jenkins-bot has submitted this change and it was merged. Change subject: Only show 'Show extended details' for file metadata having extra rows ......................................................................
Only show 'Show extended details' for file metadata having extra rows When a file only has default visible metadata, there is no need to allow extending the optional metadata, because there are none. Also added comments in ImagePage.php and shared.css because this system is scattered all over and each piece seems disconnected (the shared.css block was incorrectly documented as only being used to initially hide rows, wheareas in practice that never happens and instead the collapsed state is toggled on click). Change-Id: I595fed425135c1e8dd341258633217428bcb4154 --- M includes/ImagePage.php M resources/mediawiki.action/mediawiki.action.view.metadata.js M skins/common/shared.css 3 files changed, 13 insertions(+), 3 deletions(-) Approvals: Brian Wolff: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 93cef53..05e1899 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -262,7 +262,9 @@ # @todo FIXME: Why is this using escapeId for a class?! $class = Sanitizer::escapeId( $v['id'] ); if ( $type == 'collapsed' ) { - $class .= ' collapsable'; // sic + // Handled by mediawiki.action.view.metadata module + // and skins/common/shared.css. + $class .= ' collapsable'; } $r .= "<tr class=\"$class\">\n"; $r .= "<th>{$v['name']}</th>\n"; diff --git a/resources/mediawiki.action/mediawiki.action.view.metadata.js b/resources/mediawiki.action/mediawiki.action.view.metadata.js index ce3c674..9b27e24 100644 --- a/resources/mediawiki.action/mediawiki.action.view.metadata.js +++ b/resources/mediawiki.action/mediawiki.action.view.metadata.js @@ -3,6 +3,10 @@ * * Add an expand/collapse link and collapse by default if set to * (with JS disabled, user will see all items) + * + * See also: + * - ImagePage.php#makeMetadataTable (creates the HTML) + * - skins/common/shared.css (hides tr.collapsable inside table.collapsed) */ ( function ( mw, $ ) { $( function () { @@ -12,7 +16,7 @@ $table = $( '#mw_metadata' ), $tbody = $table.find( 'tbody' ); - if ( !$tbody.length ) { + if ( !$tbody.length || !$tbody.find( '.collapsable' ).length ) { return; } diff --git a/skins/common/shared.css b/skins/common/shared.css index 2e61f63..310294a 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -533,7 +533,11 @@ font-weight: bold; } -/* hide initially collapsed collapsable tables */ +/** + * Hide collapsable rows in a collapsed table. + * + * Used by ImagePage and the mediawiki.action.view.metadata module. + */ table.collapsed tr.collapsable { display: none; } -- To view, visit https://gerrit.wikimedia.org/r/99744 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I595fed425135c1e8dd341258633217428bcb4154 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits