Page MenuHomePhabricator

Use OOUI Layouts instead of table to display/edit multi-lingual captions on File page
Closed, ResolvedPublic

Description

On the File page multi-lingual captions are displayed and edited using a table, each caption being on a separate row

The captions should probably be displayed using OOUI HorizontalLayout elements instead

From the review comments on the patch that introduced the table:

While this works, it's not really the OOUI way, AIUI (although that can be quite the PITA sometimes, and definitely would be to overhaul now)
There's a mixin (OO.ui.mixin.GroupElement) that lets you add/edit/... OOUI widgets (addItems, removeItems, getItems, ...).
This class could basically be something like this:

var panel = new OO.ui.FieldsetLayout();
panel.addItems( [
    new OO.ui.HorizontalLayout( {
        items: [
            new OO.ui.DropdownWidget(), // language selector
            new OO.ui.TextInputWidget(), // caption text
            new OO.ui.ButtonWidget() // delete button
        ]
    } ),
    new OO.ui.HorizontalLayout( {
        items: [
            new OO.ui.DropdownWidget(), // language selector
            new OO.ui.TextInputWidget(), // caption text
            new OO.ui.ButtonWidget() // delete button
        ]
    } )
] );

And then you would:

   panel.getItems().each( function ( item )
{
       // process all values per line
   } );

Above is a very simplified example. In practice, these element probably won't suffice as-is (the dropdown will have to be something custom for ULS, for example), so you'd need to create multiple classes for each of these elements. That's the PITA part :)

Event Timeline

Cparle created this task.Sep 20 2018, 11:20 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 20 2018, 11:20 AM
Restricted Application added a project: Wikidata. · View Herald TranscriptSep 21 2018, 5:25 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptNov 9 2018, 12:33 PM

Change 479445 had a related patch set uploaded (by Cparle; owner: Cparle):
[mediawiki/extensions/WikibaseMediaInfo@master] Layout MediaInfo captions using OOUI instead of templates

https://gerrit.wikimedia.org/r/479445

Change 479445 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Layout MediaInfo captions using OOUI instead of templates

https://gerrit.wikimedia.org/r/479445

Jdforrester-WMF moved this task from To Do to Verify on Production on the SDC Engineering board.
Jdforrester-WMF removed a project: Patch-For-Review.
Ramsey-WMF closed this task as Resolved.Dec 17 2018, 5:47 PM