Background:
As a part of making working with templates in Visual Editor easier, we will change the way in which parameters can be discovered, added and removed from a template invocation. In this ticket, the add parameter/add more information button is removed from the adv toolbar since this feature is not related to editing multi-part content. The ability to add undocumented parameters remains intact, but is only shown in the situations where it's most useful: when a template does not have documented parameters and/or they cannot be autogenerated, or if a template invocation already has a mix of documented and undocumented parameters. If users know the names of the parameters within the template, they can use this component to add fields for them.
We are removing the old component because it has a lot of search functionality and results display that is not needed anymore (all parameters are visible in the side bar and it has its own search there). The only function still needed is the ability to add an undocumented parameter, so we've decided to use an input field better suited to this need.
Requirements
- Implement behind a feature flag with:
Remove previous component (hide behind feature flag):
- Remove the "Add more information" ("add parameter/add undocumented parameter" on the test instance) option from the adv toolbar (param icon) (if not done already)
- Remove the existing "Add more information" component (if not done already)
New component:
- Use OOUI component layout "ActionFieldLayout aligned top" to add an input for adding undocumented parameters with a progressive button
- Give this new input a label with the parameter icon, and a description below.
- All links open in new tabs
- This input should be visible or hidden based on the situation. It cannot be shown or hidden by the user, but is shown automatically there when these requirements are met:
- Show when a template is missing TemplateData and parameters cannot be autogenerated (inserting or editing)
- Show when the template invocation already includes at least one undocumented parameter (editing existing invocation only)
- Show when a template has TemplateData but no documented parameters (inserting or editing)
- Otherwise, hide the input.
- When shown, this input should be closed by default (only title shown) - see mocks below.
- Title is a ButtonWidget (quiet) and when clicked shows the description and input field. When clicked again it closes and shows only the title.
- When closed the icon is the OOUI 'add' icon
- When open the icons is the OOUI 'subtract' icon
- Input does not disappear from the content pane when parameter filtering is used.
- Input is visible only in the main content area and does not have a side bar element/title.
Order of components and added content:
- If shown, as per requirements above, the undoc param input should should always be at the bottom of that template's content in the right side of dialog.
- After clicking to add a parameter, add to the template above the input, which remains visible below it. Show the added parameter in the sidebar as a selected checkbox.
- Undocumented parameters, after being added to the template, are shown in alphabetical order (existing behavior)
Mocks
Closed (default) | Open |
Note: message at top of mock is not added in this ticket. Will be added in T276574: Add reactive notices and warnings in VE template dialog
Text
Title "Add undocumented parameter"
Description: If known, enter undocumented parameter names. Note that only parameters known by the template will have an effect. You may find information about existing parameters on the [[template’s page]].
Input placeholder: Parameter name
Button: Add parameter
Related tickets:
- Prototyping tickets (note, this is a significant change in behaviour from what was implemented on the test instance, so these tickets are only peripherally relevant for reference): T263573: VE Dialog on the Test Instance: Add undocumented parameters, T263419: VE Dialog on Test instance: 'Add content' toolbar dropdown, T263405: VE Dialog on the Test Instance: Implement soft validation
- Addresses the issue raised in T117890: Alert the user when adding template parameter not defined by TemplateData, both by only showing when relevant and by adding a notice
- Error messages added here T285869: Add error handling for the undocumented parameter input