Commit graph

293 commits

Author SHA1 Message Date
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
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
Thiemo Kreuz feb902aba0 Small code cleanups for the MWDismissibleMessageWidget
* Re-focus the input field after closing the message.
* Store only the message key. That's all that's needed.
* Avoid a class property that's not needed.
* Use the config object instead of calling .setLabel() manually.

Bug: T284742
Change-Id: If8e8bb6460fa5aea8ddd46c2e27b5f08b7772896
2021-06-16 10:32:08 +02:00
Andrew Kostka 13d1c4d2ac Dismissible feedback message for the template search
Bug: T284742
Change-Id: I5dc32521b899c3c9d35d1bf77d346384e4cc87e6
2021-06-16 10:03:04 +02:00
Adam Wight 950a5300dc Extract "show all" to placeholder class
We can skip all the up and down message passing by persisting the
parameter placeholders for each template dialog.  If the parameter
list is expanded then the placeholder is deleted, on being created
again it will still have state.

To test: create a transclusion with two templates, each having many
parameters.  "Add more information" to add parameters, expand the
list by clicking "Show <num> more fields", then delete the parameter
placeholder using the trash cans.  Try different permutations to fool
the cache or collide with another template.

This is preparation for other template sidebar dialog work.

Bug: T284636
Change-Id: I23bdd38b173114c2a9afafc7465c4beb92d25869
2021-06-14 18:09:26 +02:00
Thiemo Kreuz c2017f74b2 Remove @param/@return docs that literally repeat the code
These don't add any knowledge but make the code harder to read
and maintain, and are an additional source of errors.

Change-Id: Ied57741a3f985e355adfddb4e75378d5c497faa9
2021-06-14 15:44:51 +02:00
jenkins-bot 3f4cfb0fd8 Merge "Rename "value" to "wikitext" in TransclusionContent… classes" 2021-06-11 14:10:24 +00:00
Andrew Kostka 0c310d03d3 Use a new tab when linking to the project page for feedback
Bug: T284560
Change-Id: I13e7461299ccd1a584e0f661a5506e7b52b8fe4b
2021-06-10 13:06:35 +02:00
Svantje Lilienthal 1a707e2aad Add message linking to project page for feedback
Bug: T284560
Change-Id: I8ac45db4844c8ccb65595e8bfe3fb68be9bb02ee
2021-06-10 11:28:42 +02:00
jenkins-bot eca1ef82f2 Merge "Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability" 2021-06-08 19:35:17 +00:00
Thiemo Kreuz 8d7c55aa71 Rename "value" to "wikitext" in TransclusionContent… classes
This class represents a raw wikitext snippet. There is also no
base class that would require us to follow a generic
getValue/setValue naming scheme.

Change-Id: I0891a2f6c0ae0121429a47c39221e99b9653e8e3
2021-06-08 09:27:47 +02:00
Thiemo Kreuz 6f72b7a391 Move initialization of optional elements into if block
This does have a few advantages:
* Less code is executed and less memory consumed when these
  elements are not needed.
* Code that belongs together is together.
* No local class properties are created when they are not
  needed in the code below.

This patch is kind of a proof of concept. It touches only a few
classes we currently actively work with. If this change is fine
we can change some of the other classes the same way.

Change-Id: I9f548765034f1f69799fff41aeb6c147ff28b82d
2021-06-07 20:53:34 +00:00
Thiemo Kreuz cdafea5663 Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability
The main motivation for this patch is actually the comment. The
so called "spec" contains all parameters that are present in a
template, no matter if they are present in the TemplateData
documentation or not. This is critical here.

Change-Id: I5e1c79e3859a27562a9dea1d450cec196aa572ed
2021-06-04 12:49:53 +02:00
Andrew Kostka 2fe6094099 Update the delete button's feature flag in the tranclusion context menu
Bug: T274263
Change-Id: If805ce9dfc44be34e07ec79179837f12898e626e
2021-05-21 09:24:14 +00:00
Andrew Kostka e0bbf0b979 Show a delete button only in the transclusion context menu
Bug: T274263
Change-Id: Ifd81994c212cd03c1318c5fd762251ce828d9195
2021-05-17 12:26:37 +02:00
WMDE-Fisch 42b557ff80 Use add template when adding a new transclusion part
We have two cases now that we want to cover here:
- Either we're inserting a new template and start a "fresh"
  transclusion, then we want to use "search" in the headlines
- Or we're adding a new template to an exsisting
  transclusion, then we want to use "add" in the headlines

Bug: T277028
Change-Id: I9fa294cf732598d58f848c75b353d2e1742eb4e8
2021-05-11 13:13:44 +02:00
Svantje Lilienthal 2665734b10 Renaming temporary config variable and splitting it from cirrus search lookup
This allows using the config variable independendly from the cirrus search extension.
This way it can be used for all subtickets of T271802.

Bug: T277028
Change-Id: I1b3bdda5fa6fbfe5c531c3b51c2c8e2a28ed1faf
2021-05-10 14:47:31 +02:00
Adam Wight f89301bedf Optional verbose template search
Renames "Add a template" to "Template Search" in most cases and
provides inline help for the workflow.

Bug: T277028
Change-Id: I3fee87cb89b5044e785596e71ef3f1a18f2694ce
2021-05-10 12:45:12 +00:00
Andrew Kostka c1d36072ea Add collapsible descriptions to the transclusion dialog
Bug: T273426
Change-Id: I793a66f5c5877451b70058e9388dd86b3fcaadd7
2021-05-10 11:18:17 +00:00
Adam Wight d5b5300fc1 Container as a local field
We're about to replace this jQuery element by a OOUI container, and
can take an initial step by reducing its lexical scope.

Change-Id: I4123c8d22c01040fc2f61180304254498b21f5fd
2021-05-04 16:25:45 +02:00
Adam Wight cd60daf072 Internally rename container for parameter docs
The name "description" conflicts with the TemplateData field name,
which is only one of several documentation fields.

Change-Id: I0942701204fe8499e8890740585b9a02c1d14c63
2021-05-04 16:24:07 +02:00
Adam Wight abdbb7d7ff Internally rename container for adding an undocumented paramter
The internal name "more" conflicts with new collapsible buttons.

TODO: looks like TemplatePage has an analogous field?

Change-Id: I10b24758316a6cc3fbd236c77daffa014fcdafc6
2021-05-04 16:23:53 +02:00
Thiemo Kreuz 6e08a27fc7 Use standard search API when searching for templates
Bug: T274903
Change-Id: I7de8f6cc55ab678ed741ae5ebbaad608b9a9b0db
2021-04-30 12:52:45 +00:00
WMDE-Fisch e3197a82ff Increase space between fields when using inline descriptions
Bug: T273425
Change-Id: I3bf31622dbf794e1de1fa69b4fac68114c5689f7
2021-04-20 18:27:03 +02:00
WMDE-Fisch 2920c68adf Use verbose label for the example
Bug: T273425
Change-Id: Ia56aa35f98f31859e48781848b7481ebd5e2bd1c
2021-04-20 10:34:52 +00:00
Andrew Kostka 3c2db5fba9 Relocate parameter descriptions in the transclusion dialog
Bug: T273425
Change-Id: I2044b65ba88ae00e394fb84cb8e96a218995918a
2021-04-15 13:08:53 +02:00
Andrew Kostka 43c1ec5f42 Add filtering for the suggested values combo box
Bug: T271898
Change-Id: Ifb0deb117fbe40bd43c62d8be235a239a2b37f25
2021-04-14 14:11:50 +02:00
Andrew Kostka de2f5b3055 Add a combo box for suggested values in the transclusion dialog
Bug: T271898
Change-Id: Ic637eea2cac45f79234b62c787e1b76d68b61570
2021-04-08 16:10:22 +02:00
jenkins-bot b6033895f5 Merge "Add edit count bucket to VisualEditorTemplateDialogUse events" 2021-02-01 10:22:38 +00:00
Bartosz Dziewoński 185db3a157 Remove tabindex="-1" from "Add more information" button in template dialog
This makes it button keyboard-accessible, like the other buttons.

Bug: T179136
Change-Id: Ib2824176fe861e0ad8511f755521bee941119b29
2021-01-29 21:06:12 +01:00
Adam Wight 9a1072a960 Add edit count bucket to VisualEditorTemplateDialogUse events
Bug: T269986
Change-Id: I68cc15d58a23149a6edc71cac229f6b29d33fd92
2021-01-21 13:17:03 +01:00
WMDE-Fisch 2ce9934ab9 Add tracking of template usage
The names in the schema are roughly following what's
done in Schema:TemplateWizard. The information if
templates have TemplateData will be logged seperatly.

Bug: T259705
Change-Id: Iafa7256f675dbfd6a5a6de794061901780e3c55d
2020-12-16 12:56:45 +01:00
jenkins-bot b4c26620e1 Merge "Send EventLogging when adding template parameters" 2020-12-04 17:09:28 +00:00
jenkins-bot 18be32a9dd Merge "Send EventLogging when editing parameter values" 2020-12-04 17:06:22 +00:00
Adam Wight 9925ad3a88 Send EventLogging when editing parameter values
The first edit to a parameter will cause an event to be sent,
subsequent edits to the same parameter will not send an event.

Bug: T258920
Change-Id: Ibe663ce99a8fdf85a5add17186fb44fdbd4176bf
2020-11-26 11:13:14 +01:00
Adam Wight 46dad92e7d Send an event when the template doc link is clicked
Bug: T258920
Change-Id: I579472f2f9a683f63a08abc97f69c080e84bed35
2020-11-26 11:12:20 +01:00
Adam Wight 19723ba681 Send EventLogging when adding template parameters
Record that a parameter was added, and whether it was known or
unknown--whether it's documented the TemplateData.  Note that
`.isParameterKnown` returns true after an unknown parameter is added
to the template, so we need to set up the event early.

Bug: T258920
Change-Id: I5f8d8d06226474160a0a82c2e85a7fa4e22ba8cb
2020-11-26 11:10:48 +01:00
jenkins-bot c7c20dfb10 Merge "Fix config argument to explicitly pass api" 2020-09-07 19:42:48 +00:00
Adam Wight 1e96f47563 Fix config argument to explicitly pass api
These constructors only take a single argument, so the api config was
being ignored and the input would fall back to the default `new
mw.Api()`.

The order is changed so that the "api" config is merely a default,
and can be changed by whatever comes later.

The UserInputWidget currently doesn't accept an "api" config. This
will be fixed in Ifb1dd9d. But this is not a blocker. Merging this
patch here before the other won't have any consequence. It will just
continue to ignore the "api" config. ;-)

Change-Id: I15c35216c717576c6767927cac06ef72198fc95a
2020-09-01 09:36:24 +02:00
Adam Wight bf72437d63 Show image autocomplete for "File" parameters
The input field becomes a title autocomplete, showing small preview
images and searching only the File namespace.

This is consistent with how TemplateWizard behaves when editing a
File parameter.

Bug: T260886
Change-Id: I7a114e279436ec1ff6f7b8ab66443138ab12637f
2020-08-28 09:55:04 +00:00
Ed Sanders 4545f53245 build: Update eslint-config-wikimedia to 0.17.0
Fix instances of variable shadowing.

Change-Id: I6e2befb020d7d4b506c7b46131eafacd951aa6d1
2020-08-18 13:16:49 +01:00
Ed Sanders 590dc0988d Remove 'blacklist' in documentation
Bug: T254646
Change-Id: I9bad51ee248084f92de4c35d9e10d3d983f53831
2020-06-10 16:19:50 +01:00
Ed Sanders 651756c4fc eslint: Enable the mediawiki/class-doc rule and make pass
Also minor other adjustments

Change-Id: I9ee48359e3e53799f2f6240e44b53972283ce328
2020-04-17 22:59:11 +01:00
jenkins-bot faa6d75de8 Merge "Adding accessibility label to template and field name edit textbox" 2020-04-16 17:04:54 +00:00
Akinwale Alagbe 229a249cca Adding accessibility label to template and field name edit textbox
Change-Id: Ieeb29de8534300751956eb76477b38578478b4a2
2020-04-02 21:02:55 -07:00
Akinwale Alagbe a65c905287 Adding aria-label to the widgets in page settings that fail accessibility
Bug: T247048
Change-Id: I08469c9a38d905b8953b471f11839a5b99f4e7c8
2020-03-13 20:54:43 +01:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
David Chan 22098d6b16 Convert $.Deferred() to ve.createDeferred(), except in preinit
Follow-up to a8e07e026dea4f54241d1dbb6b7bcdbd8c670db2 in core.

Change-Id: I09333adb4876c6e584a4a6b6a1628227c4cd2616
2019-11-02 13:06:28 +08:00