Page MenuHomePhabricator

Create dedicated input methods for transclusion parameters (using "Param#type" from TemplateData)
Open, NormalPublic8 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
  • "date" – A date input widget
  • "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)

Details

Reference
bz53613

Related Objects

StatusAssignedTask
OpenNone
OpenNone
Resolvedmatmarex
OpenNone
Resolved AlexMonk-WMF
Resolved AlexMonk-WMF
OpenNone
ResolvedMooeypoo
ResolvedPrtksxna
ResolvedPrtksxna
ResolvedKrinkle
OpenNone
StalledNone
OpenNone
OpenNone
OpenNone
StalledNone
OpenNone

Event Timeline

bzimport raised the priority of this task from to Normal.
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 updated the task description. (Show Details)
Jdforrester-WMF assigned this task to Krenair.
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.

Jdforrester-WMF added a project: Design.
Jdforrester-WMF removed a project: WMF-Design.
Krenair added a comment.EditedJul 18 2015, 9:41 PM

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

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 18 2015, 9:41 PM

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

Krenair moved this task from Backlog to Doing on the TemplateData board.Jan 26 2016, 2:31 AM

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

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

Krenair updated the task description. (Show Details)Feb 5 2016, 11:06 PM
Krenair updated the task description. (Show Details)Feb 6 2016, 1:03 AM

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

AlexMonk-WMF removed AlexMonk-WMF as the assignee of this task.Apr 10 2016, 6:25 AM
AlexMonk-WMF updated the task description. (Show Details)
  • line is currently dealt with by a TextInputWidget without multiline: true
  • Should we have a task for wiki-file-name?
Krinkle removed a subscriber: Krinkle.Apr 26 2017, 1:23 AM
Deskana moved this task from TR0: Interrupt to Freezer on the VisualEditor board.Oct 13 2017, 10:38 AM
Magol added a subscriber: Magol.Dec 28 2017, 10:12 AM