Commit graph

16 commits

Author SHA1 Message Date
Ed Sanders ef6294074e build: Update devDependencies
Change-Id: I80bd6849b1616b9c94e75eddfbf5f476b799e07b
2022-03-13 17:17:03 +00:00
Thiemo Kreuz 2cb03827cc Fix several type hints in JavaScript code
Two main mistakes:
* The {...foo} syntax is for a variable number of parameters.
  But this is not the case here.
* Optional parameters should be marked as such via [foo].

Change-Id: I0c26ea44fab6094616443ce8fae4fd47c61fd7c4
2021-08-28 12:08:28 +02:00
jenkins-bot 73d5a6504d Merge "Change param duplicate numbering to start with 2" 2021-07-30 14:17:47 +00:00
jenkins-bot ffeaea6921 Merge "Fix handling of duplicate parameter names" 2021-07-30 14:11:09 +00:00
Adam Wight 7b32bcefb4 Add suggested values parameter
Parameters may include a `suggestedvalues` property, which is rendered
in the UI for some parameter types.

TemplateData editor UI elements are implemented behind the
TemplateDataSuggestedValuesEditor feature flag.

Bug: T271897
Change-Id: I14012c79b3fa0d48c58fd8999584cc03ec03575e
2021-04-09 12:05:37 +02:00
Thiemo Kreuz 563a44ca72 Change param duplicate numbering to start with 2
… instead of 0. Conditionally add a dash in front as well to
avoid confusing results like '1' + sequence number = '12'.

Change-Id: I345704b00ba3812c4905f85e35cf21a6dfd05437
2021-01-08 14:50:04 +00:00
Thiemo Kreuz 954211d8ba Fix handling of duplicate parameter names
I looks like the Model.params data structure is build in a way
that it allows mismatching parameter "keys" and "names". E.g.

{
    "a": { "name": "a" },
    "a0": { "name": "a" },
}

There are comments in the code that suggest this is
intentional.

I found code that confused these two values and tries to use
the name as a key, for example. This fails, messes up the
paramOrder, and such.

This should not have much, if any effect for users because
users are blocked from doing this anyway, e.g. buttons get
disabled.

Change-Id: I2067024ad8d5b8e985a4f162cf6875f523777a6c
2021-01-08 15:48:55 +01:00
Adam Wight 93b7bc0756 Drop unnecessary top-level closures
Change-Id: Ie8fbde864cd08f0657e4239f525ef9dd087aee41
2020-12-07 15:24:31 +01:00
Adam Wight bda6215309 Migrate to package files: ext.templateDataGenerator.data
Bug: T260343
Change-Id: Ifd171b40de704bff8c063da46b711a384238a0f5
2020-12-04 19:41:30 +01:00
jenkins-bot 86a6865512 Merge "Fix parameter extraction from wikitext source" 2020-10-06 23:07:23 +00:00
Thiemo Kreuz de434822b4 Fix all eslint warnings
Change-Id: I731ea4a54b001a8d30743ca32188edb1c039253e
2020-09-24 13:31:18 +01:00
Thiemo Kreuz f6de5d3493 Fix parameter extraction from wikitext source
This fixes a series of issues:
* The JS implementation had a trim() in one place that was
  missing in PHP.
* The actual parameter name in the paramNames/$params array was
  trimmed, but the "normalized" name (this is only for duplicate
  detection) was not trimmed.
* It was possible for an empty parameter to show up.

This resulted in very strange behavior, e.g. {{{ 1}}}{{{1 }}}
was detected as "1" and "10" (?), i.e. it would try to renumber
the duplicate in a strange way (string "1" plus a counter that
starts with 0).

Change-Id: I0a6371f3633b03b5b21809ecd06ea4c72d7d914d
2020-09-22 18:27:23 +02:00
Marielle Volz 9760fed11d Add map to Qunit tests
Add roundtrip test where a maps object is present.

Bug: T261406
Change-Id: I620e60599a28c677f1af6231f36bdb39658afb7a
2020-08-30 15:07:03 +01:00
Ed Sanders 49d469b2d1 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: Ia8baa12906d4f23fcdf07a0bb664b4a3435d18df
2019-02-10 22:14:11 +00:00
Ed Sanders 47c3c69baa Update eslint-config-wikimedia to 0.9.0
Also bump stylelint (no fixes required)

Change-Id: Ia6bd3a8c0392eafb939f9ff05827e1320f56b706
2018-11-29 14:19:33 +00:00
Ed Sanders 9a8c807f51 eslint: Introduce wikimedia/qunit ruleset
Change-Id: I3972918c00e69d325c5cb2055d4996a8c07b1034
2018-11-15 23:21:32 +00:00