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
  • "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 VE surface with locked height and no toolbar
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 changed the title 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 edited the task description. (Show Details)
Jdforrester-WMF assigned this task to Krenair.
Jdforrester-WMF set Security to None.
Jdforrester-WMF moved this task from Backlog to TR9: ???? on the VisualEditor board.
Jdforrester-WMF moved this task from TR9: ???? to TR5: Rich media tools 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 edited the task description. (Show Details)Feb 5 2016, 11:06 PM
Krenair edited 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.Sun, Apr 10, 6:25 AM
AlexMonk-WMF edited 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?

Add Comment