Mobile friendly styling of Special:ListFiles

This makes core's Special:ListFiles match the styling of
Special:Uploads that is provided by MobileFrontend. The latter
can be removed once this change is incorporated.

The tablet/desktop mode of this page is not impacted except
that the title will be context aware when a username is selected
to show "Uploads by <username>" rather than the generic "list files".

Bug: T102139
Change-Id: I266313b8c71bdf410d336e020aca7dabbe115be5
This commit is contained in:
jdlrobson 2019-09-11 14:31:56 -07:00 committed by Jdlrobson
parent 6cf4d8f64e
commit 9da8a8cb6c
5 changed files with 53 additions and 0 deletions

View file

@ -40,6 +40,11 @@ class SpecialListFiles extends IncludableSpecialPage {
$search = $this->getRequest()->getText( 'ilsearch', '' );
$showAll = $this->getRequest()->getBool( 'ilshowall', false );
}
if ( $userName ) {
$pageTitle = $this->msg( 'listfiles_subpage', $userName );
} else {
$pageTitle = $this->msg( 'listfiles' );
}
$pager = new ImageListPager(
$this->getContext(),
@ -51,6 +56,8 @@ class SpecialListFiles extends IncludableSpecialPage {
);
$out = $this->getOutput();
$out->setPageTitle( $pageTitle );
$out->addModuleStyles( 'mediawiki.special' );
if ( $this->including() ) {
$out->addParserOutputContent( $pager->getBodyOutput() );
} else {

View file

@ -1893,6 +1893,7 @@
"listfiles-userdoesnotexist": "User account \"$1\" is not registered.",
"imgfile": "file",
"listfiles": "File list",
"listfiles_subpage": "Uploads by $1",
"listfiles_thumb": "Thumbnail",
"listfiles_date": "Date",
"listfiles_name": "Name",

View file

@ -2103,6 +2103,7 @@
"listfiles-userdoesnotexist": "This message is displayed on [[Special:ListFiles]] when a invalid username is entered.",
"imgfile": "{{Identical|File}}",
"listfiles": "Page title and grouping label for the form displayed on [[Special:ListFiles]].\n{{Identical|List}}",
"listfiles_subpage": "Page title and grouping label for the form displayed on [[Special:ListFiles]].\n{{Identical|List}} when a username is selected. Parameters:\n * $1 - username",
"listfiles_thumb": "{{Identical|Thumbnail}}",
"listfiles_date": "Column header for the result table displayed on [[Special:ListFiles]].\n{{Identical|Date}}",
"listfiles_name": "Column header for the result table displayed on [[Special:ListFiles]].\n{{Identical|Name}}",

View file

@ -1998,6 +1998,7 @@ return [
'resources/src/mediawiki.special/userrights.css',
'resources/src/mediawiki.special/watchlist.css',
'resources/src/mediawiki.special/block.less',
'resources/src/mediawiki.special/listFiles.less',
'resources/src/mediawiki.special/blocklist.less',
],
'targets' => [ 'desktop', 'mobile' ],

View file

@ -0,0 +1,43 @@
@import 'mediawiki.ui/variables';
// On mobile devices the table layout is collapsed.
@media all and ( max-width: @width-breakpoint-tablet ) {
.mw-special-Listfiles {
// stylelint-disable selector-class-pattern
thead,
.TablePager_col_count,
.TablePager_col_img_size,
.TablePager_col_img_name,
.TablePager_col_img_timestamp {
display: none;
}
tbody,
tr,
td,
.mw-datatable,
.TablePager_col_img_description,
.TablePager_col_thumb {
display: block;
}
.mw-datatable,
.mw-datatable th,
.mw-datatable td {
border: 0;
}
.TablePager_col_img_user_text,
.TablePager_col_img_description {
color: @colorGray5;
margin: 0.5em 0 0;
padding-bottom: 40px;
line-height: 1.5;
}
.TablePager_col_img_user_text {
padding: 0;
}
// stylelint-enable selector-class-pattern
}
}