Page MenuHomePhabricator

Document HTMLForm ooui mode
Closed, ResolvedPublic

Description

Now we have T85291, let's document it.

mediawiki.org

The HTMLForm wiki page mentions the 'ooui format

doxygen

classHTMLForm documents the $availableSubclassDisplayFormats value ooui, but the comment for it is identical to $availableDisplayFormats: "Available formats in which to display the form. " AIUI you can setDisplayFormat() to some formats, but ooui and vform must be set via HTMLForm::factory().

Sample code

Point to any shipping code using ooui with HTMLForm.

We should ship the source code listed in HTMLForm and HTMLForm/tutorial wiki pages with the examples extension.
If I add the code in HTMLForm "Example usage" to Boilerplate and add the 'ooui' factory line, I get

2015-05-26 HTMLForm sample ooui.png (912×731 px, 45 KB)
, which is imperfect (do we need to convert HTMLMultiSelectField to new-style checkbox?).

Conversion

To assist T100270: Replace use of jQuery UI and MW UI with OOUI across all Wikimedia-deployed extensions and core we should probably explain how to convert existing HTMLForm code. As well as code guidance we need design guidance, e.g. remove section that produces the border lines, etc.

Event Timeline

Spage raised the priority of this task from to Needs Triage.
Spage updated the task description. (Show Details)
Spage subscribed.
Spage set Security to None.

Change 213786 had a related patch set uploaded (by Spage):
Add HTMLForm example code to special page

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

Besides awaiting the OOjs UI implementation of
HTMLMultiSelectField and HTMLRadioField, presumably developers ought to
change design, e.g. not use the 'section' border lines. I want to document
how to do the conversion.

By section border lines do you mean the borders of the <fieldset> element? This might get solved with the transition to OO.ui.FieldsetLayout.

Updated screenshot, as of today:

pasted_file (931×746 px, 45 KB)

OOUI version of HTMLForm doesn't really support subsections, it would require some refactoring of HTMLForm internals (which are too geared towards concatenating strings to produce the form, rather than building a tree-like structure that OOUI requires). It's possible to fix it, but it's not a priority now, so I think it'd be okay to just document the limitation and don't make OOUI examples with them for now :). Everything else looks good to me now.

@Spage, can you figure out what needs to be done here and instruct me to do it? :)

So @Spage is gone.. what do we want to do with the open patchset
@matmarex @Volker_E thoughts? Seems a shame to waste.

I suppose we could merge it, since everything in it seems to work just fine now. The code it changes got moved to the BoilerPlate extension repository, so the patch needs the same too, I'll do it.

pasted_file (958×836 px, 49 KB)

Change 291215 had a related patch set uploaded (by Bartosz Dziewoński):
Add HTMLForm example code to special page

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

Change 213786 abandoned by Bartosz Dziewoński:
Add HTMLForm example code to special page

Reason:
This code got moved to another repository, migrating the patch: https://gerrit.wikimedia.org/r/#/c/291215/

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

Change 291215 merged by jenkins-bot:
Add HTMLForm example code to special page

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