Page MenuHomePhabricator

Create dedicated input methods for transclusion parameters (using "Param#type" from TemplateData)
Open, MediumPublic8 Estimated Story Points

Description

"unbalanced-wikitext" and "unknown" – continue as a raw wikitext input field

All others need the ability to bypass for raw values (e.g. {{#if:…}} instead of "4" for number):

  • "string" – A plain text input widget, allows multiline
  • "number" – A number input widget – T124850
  • "boolean" – A checkbox input widget – T144155
  • "date" – A date input widget – T100206
  • "url" – A link input widget
  • "wiki-page-name" – An mw.widgets.TitleInputWidget with validity checking – T124734
  • "wiki-user-name" – An mw.widgets.UserInputWidget – T124736
  • "wiki-file-name" – An image search and selection widget of some kind
  • "wiki-template-name" – An mw.widgets.TitleInputWidget for NS10 with validity checking
  • "content" – A full VE surface – T52355
  • "line" – A plain text input widget, not multiline – T55613

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
Resolvedmatmarex
OpenNone
Resolved AlexMonk-WMF
Resolved AlexMonk-WMF
OpenNone
ResolvedMooeypoo
Resolved Prtksxna
Resolved Prtksxna
ResolvedKrinkle
OpenNone
OpenFeatureNone
DeclinedNone
OpenNone
OpenNone
OpenNone
OpenNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:08 AM
bzimport set Reference to bz53613.

Change 169936 had a related patch set uploaded by Alex Monk:
Use MWTitleInputWidget for wiki-page-name parameters, add MWUserInputWidget for wiki-user-name

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

Jdforrester-WMF renamed this task from VisualEditor: Create dedicated input methods for transclusion parameters (using "Param#type" from TemplateData) to Create dedicated input methods for transclusion parameters (using "Param#type" from TemplateData).Nov 24 2014, 1:44 AM
Jdforrester-WMF assigned this task to Krenair.
Jdforrester-WMF updated the task description. (Show Details)
Jdforrester-WMF set Security to None.
Jdforrester-WMF moved this task from Freezer to TR6: Visual diffs on the VisualEditor board.
Jdforrester-WMF moved this task from TR6: Visual diffs to Blocked on the VisualEditor board.

Needs design input to work out how we should handle existing invalid input, and how we should continue to allow invalid input.

James and I discussed how this should work, and decided that we'll try to provide the correct input widget for the given parameter type where possible (falling back to wikitext where the current value obviously isn't), as well as providing the user with a button to always fall back to wikitext (because sometimes the TemplateData for the parameter might just be wrong). We're not actually given the Parsoid HTML of individual parameters by Parsoid/RESTBase, and need to figure that out with upstream. Blocker bug to follow.
Edit: T106242: Create API to get both Parsoid HTML and wikitext for individual template parameters in a given transclusion block

Change 169936 had a related patch set uploaded (by Alex Monk):
[WIP] Use widgets for wiki-page-name and wiki-user-name parameters

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

May I request that this is implemented in a way that enables extensions to register custom input widgets? Technically this is not hard to achieve:

  1. Specify the interface the input widget must implement (currently, it must be an EventEmitter, implement the methods setValue, getValue and simulateLabeClick and have an $element).
  2. Add 'widgetType' and 'widgetConfig' to TemplateData, where 'widgetConfig' is a JSON string.
  3. Instantiate input widgets from a factory with fallback to 'text'.

Regarding invalid input I suggest the following: Allow the setValue method to throw an exception. (There could also be a button next to the input widget to replace it with a text input in case you want to be able to input values the widget can't handle).

I have a patch for this, which I guess I could commit to gerrit.

Change 266446 had a related patch set uploaded (by Alex Monk):
TitleInputWidget: Allow config to disable validation

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

Change 266446 merged by jenkins-bot:
TitleInputWidget: Allow config to disable validation

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

Change 268854 had a related patch set uploaded (by Alex Monk):
Use widgets for wiki-template-namep, boolean and URL template fields

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

Change 268854 abandoned by Alex Monk:
Use widgets for wiki-template-name, boolean and URL template fields

Reason:
Re-arranging these patch sets, squashing etc.

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

Change 169936 had a related patch set uploaded (by Alex Monk):
[WIP] Use widgets for wiki-page-name, wiki-user-name, wiki-template-name, boolean, URL and line template fields

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

Change 169936 merged by jenkins-bot:
Use widgets for wiki-page-name, wiki-user-name, wiki-template-name, boolean, URL and line template fields

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

  • line is currently dealt with by a TextInputWidget without multiline: true
  • Should we have a task for wiki-file-name?

Hi! Is there any chance that this will be completed in the coming years? :)