Commit graph

17633 commits

Author SHA1 Message Date
Translation updater bot 1348b34693 Localisation updates from https://translatewiki.net.
Change-Id: Ib398fedb4a1fc9b9d7dba936826c78aaf46fef10
2021-06-24 08:27:27 +02:00
Adam Wight 1909fdff92 Revert "Revert "Fall back from explicit parameter order to TemplateData sort""
This reverts the revert commit d47b95eb4a.

When no `paramOrder` is given, known parameters should appear in the
order returned from the TemplateData API.

Previously, when TemplateData was present but no paramOrder
specified, then the parameters would appear in alphabetical order as
"unknown" parameters.  Now they will appear in the order listed in
TemplateData.  This is similar to the fully-specified behavior when
paramOrder is present.

This will only affect the Visual Editor template dialog, and has no
effect on serialization.

Bug: T274545
Change-Id: If8315781572af688ea1c1b14b3694b828f076b4a
2021-06-23 16:39:13 +02:00
Adam Wight 05bcb89f3f Tests for parameter serialization order
The results show that parameter order always follows the appearance
in the template invocation, regardless of `paramOrder`, whether the
parameters are aliased, or whether there are unknown params.

Bug: T285382
Change-Id: I76c6fe8f0a2482cf0856bbafd9f21ba9fc4919a4
2021-06-23 16:38:30 +02:00
jenkins-bot 2cbb32302f Merge "Inline many var declarations in the code below" 2021-06-23 09:24:05 +00:00
Thiemo Kreuz 4367235dcc Inline many var declarations in the code below
This makes the code more readable and easier to reason about.
The ESLint rule responsible for this code style was removed
just recently.

Notes:
* I focus on classes that are relevant for what the WMDE team
  does right now.
* I merge multiple `var` keywords only when the variables are
  strongly connected.
* Caching the length in a for loop makes the code hard to
  read, but not really faster when it's a trivial property
  access anyway.

Bug: T284895
Change-Id: I621fed61d894a83dc95f58129bbe679d82b0f5f5
2021-06-23 09:02:24 +00:00
Translation updater bot 69a3ff2c04 Localisation updates from https://translatewiki.net.
Change-Id: Ifceab025b106fcf05a2e70414ea89ff989e705c9
2021-06-23 08:12:08 +02:00
jenkins-bot d1c07aced8 Merge "Revert "Fall back from explicit parameter order to TemplateData sort"" 2021-06-22 18:16:33 +00:00
Awight d47b95eb4a Revert "Fall back from explicit parameter order to TemplateData sort"
This reverts commit 12f3ce5ed3.

Reason for revert: Considered undesirable, per T138200

Change-Id: I089a47b41a0bb0405841690ca577035cf95a8016
2021-06-22 17:50:16 +00:00
Adam Wight 1100db9665 Revert "Make template dialog header tooltip match title"
This reverts commit 7d05257059.

Change-Id: I16395c1118a5a1afe6c0f9022e478f38a2ac3755
2021-06-22 15:37:09 +02:00
jenkins-bot aeea9f1781 Merge "Fall back from explicit parameter order to TemplateData sort" 2021-06-22 12:43:30 +00:00
jenkins-bot 7089fb3c15 Merge "Tests for getAllParametersOrdered" 2021-06-22 12:37:18 +00:00
Adam Wight 12f3ce5ed3 Fall back from explicit parameter order to TemplateData sort
When no `paramOrder` is given, known parameters should appear in the
order returned from the TemplateData API.

Previously, when TemplateData was present but no paramOrder
specified, then the parameters would appear in alphabetical order as
"unknown" parameters.  Now they will appear in the order listed in
TemplateData.  This is similar to the fully-specified behavior when
paramOrder is present.

This will only affect the Visual Editor template dialog.

Bug: T274545
Change-Id: I32538de07641c288081042a41fe39eedfed7d939
2021-06-22 13:24:44 +02:00
Adam Wight 33701872c7 Tests for getAllParametersOrdered
Note that the tests expose a bug, getAllParametersOrdered fails to
list an unused parameter.  Fixed in I32538de07641c.

Also, a minor fix to avoid an impossible template spec: paramOrder
must include all parameters.

Bug: T274545
Change-Id: Icfa7a765773d04ef05a76ecc09467305e311f6cb
2021-06-22 13:23:59 +02:00
Adam Wight 7d05257059 Make template dialog header tooltip match title
The tooltip is useful for languages where the dialog title might get
truncated.  This patch makes sure the tooltip is always the same as
the visible label.

Bug: T276568
Change-Id: I678bb243bb5ac6d1c516ee4e146f2db9ffd5afcf
2021-06-22 13:16:17 +02:00
Translation updater bot c396871c59 Localisation updates from https://translatewiki.net.
Change-Id: Ie8a4fba0227d4a3e3885b160b776dfcc620a9082
2021-06-22 08:10:07 +02:00
jenkins-bot 3fbd568b07 Merge "ve.ui.MWSaveDialog: Tweak margins of checkboxes" 2021-06-21 22:30:23 +00:00
jenkins-bot 126eb076c1 Merge "Only add asterisk after word characters in improved template search" 2021-06-21 19:29:30 +00:00
WMDE-Fisch c4f59132ae Only add asterisk after word characters in improved template search
This will avoid that the search breaks in edge cases where symbols
are used.

Including a fallback for ES5 browsers. The fallback should cover
almost all cases. Worst case would be not adding the asterisk even
though it might be valid.

Bug: T284554
Change-Id: Ie4aee0b77492b7a73bc251a8723a206dbd641600
2021-06-21 21:07:28 +02:00
jenkins-bot 06ea3f84f8 Merge "Rewrite MWTransclusionDialog methods for readability" 2021-06-21 10:41:39 +00:00
Thiemo Kreuz 02afb7a499 Add terminology section to README
Change-Id: I35feaea397fdbbfcfeab246d77631ba75f61921d
2021-06-21 12:39:26 +02:00
jenkins-bot ca1f7b7869 Merge "Rename OutlineParameterCheckboxWidget to OutlineParameterCheckboxLayout" 2021-06-21 07:30:23 +00:00
WMDE-Fisch 407ff95597 Rename OutlineParameterCheckboxWidget to OutlineParameterCheckboxLayout
This not really just a checkbox widget anymore it inherits from
FieldLayout and became something more in that direction.

Let's use a mixture of these things to make it a bit clearer.

See also comment in Ie81b84be288553343017c4aaf8691c4e266995f5

Change-Id: Iff1746a8e5e94b56eb6c27465405aaf6b74c2310
2021-06-21 09:08:54 +02:00
Bartosz Dziewoński 1570507656 Update VE core submodule to master (6c7bee041)
New changes:
5e3ee8ae9 Help dialog: Hide commands which are not in surface.getCommands()
6c7bee041 CommandHelpDialog: Rewrite for-loops

Bug: T284758
Change-Id: I408132ae6b858cf6efd81f67d3a7a3123d384c59
2021-06-19 15:58:36 +02:00
Thiemo Kreuz 58ec3006ba Update documentation for all getWikitext()/serialize() methods
There are at least 3 different methods that are all named
getWikitext, not counting subclasses. They behave rather
different, most notably in terms of whitespace preservation.

Bug: T284895
Change-Id: I8b47f5bd21675a431ba2bc2d4a8cb0c55dd50f76
2021-06-18 17:30:29 +02:00
jenkins-bot 4761ed3b15 Merge "Add missing newline in JSDoc" 2021-06-18 14:30:54 +00:00
Thiemo Kreuz c6f2683dd8 Rewrite MWTransclusionDialog methods for readability
Most notably:
* Introduce variable names that explain much better what's
  going on.
* Reduce nesting.

Bug: T284895
Change-Id: I793677d8107abb6354f9e19d79c4879a41c4bd93
2021-06-18 16:09:52 +02:00
jenkins-bot f7726e17e0 Merge "Function to get all potential template parameters, in order" 2021-06-18 13:30:38 +00:00
jenkins-bot 107014ccce Merge "Tests for MWTemplateModel parameter ordering" 2021-06-18 13:00:30 +00:00
WMDE-Fisch 0e04315c66 Add missing newline in JSDoc
Change-Id: I88f5814e3691f4787a04ac8c882a4c836d786bd7
2021-06-18 14:13:31 +02:00
Thiemo Kreuz c135f10f72 Remove unused "insert" action from MWTemplateDialog
This action was removed via Ib744b89 in 2019, see
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/491537/4/modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js
Note the messages that are removed in this patch:
* …-action-insert was used for the "insert" action.
* …-action-apply was used for an "apply" action.
* …-action-cancel doesn't mention an action. Internally,
  the cancel action is "".

Since Ibd740ad the actions are registered in the
FragmentDialog superclass, see
https://gerrit.wikimedia.org/r/c/VisualEditor/VisualEditor/+/491536/2/src/ui/dialogs/ve.ui.FragmentDialog.js
Note the messages. Cancel is unchanged. …-action-insert and
…-action-apply are still there, but both linked to the same
"done" action. The "apply" and "insert" actions are gone.
I.e. they are merged into a single "done" action, represented
by a single button that changes the label from "Insert" to
"Apply changes" when needed.

On top of that,
MWTransclusionDialog.updateActionSet() replaces "Apply
changes" with "Save".

Note: Other dialogs also mention an "insert" action. I didn't
look at these. These are not in the focus of our team's
current project.

Bug: T284895
Change-Id: I1d35ada3b5b2049ed20c2d940a1c065b704c978d
2021-06-18 13:44:35 +02:00
Adam Wight c3c91275ce Function to get all potential template parameters, in order
Splits out a useful intermediate calculation from getOrderedParameterNames,
exposing the full list of parameters including those that are not
present in the transclusion.

This will be used to build the sidebar checkbox list.

Bug: T274545
Change-Id: I1c6a9ea8a5e9a163751fee87f974f63c72fd1f61
2021-06-18 13:43:19 +02:00
Adam Wight 9e1c76f0fc Tests for MWTemplateModel parameter ordering
Documents existing logic.

Bug: T274545
Change-Id: Iebcbdb186862060724d29b36112b2d262112c4c8
2021-06-18 13:43:15 +02:00
jenkins-bot 853fb2710f Merge "Add missing word wrapping to template/param descriptions" 2021-06-18 09:23:32 +00:00
jenkins-bot 595b3a1caf Merge "Better variable names for the template dialog's "single" mode" 2021-06-18 08:34:54 +00:00
Translation updater bot 3d9a316adf Localisation updates from https://translatewiki.net.
Change-Id: Ife24b109ef81051c35ba1826622fcdf662a26eb5
2021-06-18 08:21:25 +02:00
jenkins-bot 841bcd1b54 Merge "Remove unused .onAddParameterBeforeLoad() method" 2021-06-18 01:06:28 +00:00
Thiemo Kreuz 2bdda88ee2 Small documentation updates in transclusion model classes
Bug: T284895
Change-Id: I9cc02518f279b9f165447427b0313bd179085c22
2021-06-17 18:33:06 +02:00
Thiemo Kreuz 2a1defc26f Remove unused .onAddParameterBeforeLoad() method
https://codesearch.wmcloud.org/search/?q=onAddParameterBeforeLoad&i=1

Bug: T284895
Change-Id: Ib521e05d8def8514ffe1b3c3822f0151ab10932e
2021-06-17 18:30:02 +02:00
Thiemo Kreuz bba592460d Better variable names for the template dialog's "single" mode
The "mode" button is the button that allows to expand and
collapse the dialog. It can't be collapsed when multiple
templates are edited. That's what these lines do,
disabling the button.

"Can expand" is not the correct question. It's always
possible to expand the dialog no matter what it contains.

Bug: T284895
Change-Id: I60f3060695c80bf5541ef2156be89b85a62bf91b
2021-06-17 18:24:17 +02:00
jenkins-bot e9411fb71c Merge "Template dialog checkbox list" 2021-06-17 09:15:11 +00:00
jenkins-bot f6f3dfa54e Merge "Make use of Array.some() in a few places" 2021-06-17 08:52:54 +00:00
Adam Wight 988cda65dd Template dialog checkbox list
Introduces new widgets forming the backbone of the experimental
template dialog sidebar.

FIXME: `text-overflow: ellipsis` is not working yet, the container
styles need adjustment.

Bug: T274543
Change-Id: Ie81b84be288553343017c4aaf8691c4e266995f5
2021-06-17 08:47:47 +00:00
jenkins-bot 4e126871f0 Merge "Add tooltip to "dismissible message" close button" 2021-06-17 07:16:54 +00:00
Translation updater bot 204fa2c00f Localisation updates from https://translatewiki.net.
Change-Id: I247911e098bf982f24ebf955b0874a960bf784ce
2021-06-17 08:21:07 +02:00
Thiemo Kreuz d9596c7f20 Add tooltip to "dismissible message" close button
Bug: T284742
Change-Id: Ibf0cb23c44d440e7a986bc85120f4ea0f844d999
2021-06-17 07:57:10 +02:00
Thiemo Kreuz 6da5b9269b Add missing word wrapping to template/param descriptions
Both the template description as well as the parameter
description (including default value and examples) typically
contain longer texts. These can contain longer words that
"explode" the design. This is trivial to avoid.

Note this is not meant to fix this issue in all places where
it can appear. For example, a long parameter name causes the
same issue. But:
* Technically, it's not that easy to fix.
* Even if, it's not obvious how to fix it. Cut off the
  container? Add ellipsis? Or wrap? How should the
  surounding stuff float then?
This is all left out because of this. Focus on what's
obvious.

Bug: T284890
Change-Id: Id6700af168f5ab5ddde97d3f5ae63829b65a3be5
2021-06-16 14:31:35 +02:00
jenkins-bot 8b64e54149 Merge "Fix bad parameter ID "…/undefined" on placeholders" 2021-06-16 12:28:12 +00:00
jenkins-bot 6d101fb9d7 Merge "Extract "show all" to placeholder class" 2021-06-16 12:25:55 +00:00
jenkins-bot ab47e5ff9a Merge "Small code cleanups for the MWDismissibleMessageWidget" 2021-06-16 11:11:47 +00:00
jenkins-bot 2a74f10909 Merge "Dismissible feedback message for the template search" 2021-06-16 11:02:50 +00:00