Page MenuHomePhabricator

TemplateData: extend data model to include a predefined set of values for a parameter ("enum"-like)
Closed, DuplicatePublic

Description

Author: l736ewiki

Description:
Some templates foresee, for some parameters, a restricted choice of values among a predefined set. Examples for that are, on it.wiki, the "Bio" template which foresees, for the "Sesso" ("Gender") parameter only a choice between "M" and "F". There are also other templates which foresee a larger set, but always within a restricted choice (e.g. for automatic categorization purposes).

For such cases, it could be useful to extend the data model for the "params" object inside the TemplateData, by adding a new attribute, e.g. "choices" with array data type. For the "Bio" template of the example, this could boil out in something like:

"params": {

"label":"Gender",
"type": "string",
"choices": ["M","F"]   <---- proposal
}

The values defined for the "choices" attribute could then be used by the visual rendering of VE to present the user with a drop-down menu (similar to HTML's "<select><option> structure) listing only the allowed values, instead of a free text input field.


Version: unspecified
Severity: enhancement

Details

Reference
bz52754