Last modified: 2014-07-08 06:31:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T53375, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51375 - TemplateData: Add parameter type for selecting one of predefined values (like "<select>" or ENUM)
TemplateData: Add parameter type for selecting one of predefined values (like...
Status: ASSIGNED
Product: MediaWiki extensions
Classification: Unclassified
TemplateData (Other open bugs)
unspecified
All All
: High enhancement with 3 votes (vote)
: ---
Assigned To: Editing team bugs – take if you're interested!
:
: 50760 52754 (view as bug list)
Depends on:
Blocks: td-param-type
  Show dependency treegraph
 
Reported: 2013-07-15 17:41 UTC by Carl Fürstenberg
Modified: 2014-07-08 06:31 UTC (History)
11 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Carl Fürstenberg 2013-07-15 17:41:32 UTC
Sometimes for templates, you have a pre-defined set of values to use for a parameter. Perhaps it could be a nice thing to expose valid values to the user in a drop down or something.
Comment 1 NicoV 2013-07-16 09:53:01 UTC
See "bug 50760 - Support suggested values" which is quite similar.

https://bugzilla.wikimedia.org/show_bug.cgi?id=50760
Comment 2 Krinkle 2013-08-26 23:27:46 UTC
Ping @TrevorParscal.

Since wikitext template editing will always be possible, we can't (yet?) enforce values in VisualEditor. We can only suggest.

E.g. if a template parameter "foo" is specified as values: ['a', 'b']. and wikitext has {{echo|foo=x}}, we need to provide a way to edit that, while still being able to set it to a or b.
Comment 3 Krinkle 2013-08-26 23:28:01 UTC
*** Bug 50760 has been marked as a duplicate of this bug. ***
Comment 4 James Forrester 2013-08-28 02:43:01 UTC
(In reply to comment #2)
> Ping @TrevorParscal.
> 
> Since wikitext template editing will always be possible, we can't (yet?)
> enforce values in VisualEditor. We can only suggest.
> 
> E.g. if a template parameter "foo" is specified as values: ['a', 'b']. and
> wikitext has {{echo|foo=x}}, we need to provide a way to edit that, while
> still
> being able to set it to a or b.

The "normal" way is a drop-down with the target of the drop-down being a free-entry text field that suggests entries (but does not block other entries).
Comment 5 James Forrester 2013-08-30 02:48:45 UTC
*** Bug 52754 has been marked as a duplicate of this bug. ***
Comment 6 Krinkle 2014-05-20 20:01:52 UTC
Yeah, we should add this. Though it doesn't have to be as a parameter type. I imagine we could also do it more generically.

params: {
  "key": {
    "type": ...
    "values": [ .. ]

The upside is that this is easier to specify and validate.

An nice bonus is that it would allow one to preserve types regardless of whether the possible values are finite or not (e.g. freeform strings, numbers, dates, page names).

Down side is that it's tricky for consumers like VisualEditor to have a dropdown menu for values that aren't simple strings.

But I think that's fine. Those consumers can choose to support it however they like. E.g. they could support "values" only for string values.

As a nice bonus this would allow VisualEditor to make dedicated select interfaces much better. E.g. a colour picker with limited values could be a row with squares and you visually pick one of those colours (like radio buttons). And a parameter that takes file names (e.g. for icons), could have live previews for the 10 different icons it supports.

The type-restricted implementation would look something like this:

params: {
  "key": {
    "type": "options"
    "values": [ .. ]

And would treat them as type: 'string' with no further type association.

It also has the downside of having a "param" property (values) that only makes sense in combination with another. Making it slightly less intuitive.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links