Commit graph

303 commits

Author SHA1 Message Date
Ed Sanders 0d7d717253 ESLint: Fix warnings
Change-Id: I62b6f011a1068efd637a09388a8b12b92750068e
2024-09-16 15:54:00 +01:00
Ed Sanders 4993f74649 oojs: Replace parent with super
Change-Id: Ibab659920d4a6e44fde53299c5677fbfe346d93f
2024-09-16 15:52:34 +01:00
Timo Tijhof 16c6546129 Prepare Less styles for math=parens-division
Bug: T368921
Change-Id: I124273a30b4b374908e6ac2a3a0a386e56180086
2024-07-01 16:11:08 +01:00
libraryupgrader e6794ad440 build: Updating npm dependencies
* eslint-config-wikimedia: 0.27.0 → 0.28.2
  The following rules are failing and were disabled:
  * modules:
    * no-mixed-spaces-and-tabs
    * implicit-arrow-linebreak
  * modules/ext.templateDataGenerator.editTemplatePage:
    * no-mixed-spaces-and-tabs
    * implicit-arrow-linebreak

* grunt-stylelint: 0.20.0 → 0.20.1
* stylelint-config-wikimedia: 0.17.1 → 0.17.2

Change-Id: Ibafc7bb747791b5e9337fdb153aab39aa7893273
2024-06-22 11:16:08 +00:00
jenkins-bot 563828f594 Merge "Add lang and dir attributes to language search result rows" 2024-06-07 02:15:24 +00:00
thiemowmde a087036f90 JSDoc: convert @cfg to @param
Bug: T138401
Change-Id: I5cd2c2552b40ed072054e4f7ae00b82dcd432ab9
2024-05-28 10:18:36 +02:00
thiemowmde 1b7e3f6df5 Streamline code in Dialog.js and related
The goal is to make the code (especially the very large Dialog class)
more readable and easier to maintain.

Notable:
* Move cheap === comparison to the top.
* Use boolean .test() instead of .match() when we don't need an array.
* Use chained method calls where possible.

Change-Id: I1655174494911950d9d6530a512828e60bf5375d
2024-05-17 07:13:41 +00:00
thiemowmde 2d0ac92728 Drop unused "Restore parameter" messages and code
As far as I can see this was never used, not even in the original
patch Ib739ee0 that added it.

Bug: T86916
Change-Id: Ibaed8504791e54348584a5f66095a9f36e83601d
2024-05-13 19:15:09 +02:00
thiemowmde 8b474b1b07 Add lang and dir attributes to language search result rows
The languages in this list are presented as "autonyms", meaning it's
the name of the language written in the language. They should be
marked accordingly in the DOM.

However, the current design breaks appart when we allow some of
the rows to be right-aligned. To avoid this we enforce the previous
left-align via CSS. This is not perfect but the best compromise at
the moment, in my opinion.

The code follows what we did in T238329, specifically the patch
Ifcbb877.

Bug: T324385
Change-Id: I53a5a96395b60f3e5d0d80bd5efa4024c4d97884
2024-04-30 21:19:17 +02:00
jenkins-bot 7f4d21ce30 Merge "Remove misplaced message keys from a comment" 2024-02-27 17:51:20 +00:00
libraryupgrader 2e0f4426ac build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* eslint-config-wikimedia: 0.25.1 → 0.26.0
* debug: 3.2.6, 4.3.4 → 3.2.7, 4.3.4
  * https://github.com/advisories/GHSA-gxpj-cx7g-858c

Change-Id: Iaa4643e6011772378fe3274166410b3eea701061
2024-02-13 03:26:37 +00:00
thiemowmde b703aa71e6 Remove misplaced message keys from a comment
These messages are still used in ParamImportWidget, originally added
via I985ea03 in 2014. The comments have been added much later, see
Ib53aa55. This was really only a copy-paste mistake because of the
very similar message keys.

Change-Id: I78e1a8aec200299e72ce8354ea722ad9c1fd27c0
2023-12-11 15:11:21 +01:00
Thiemo Kreuz b2574932e9 Turn deprecated/required/suggested checkboxes into select widget
* deprecated means "please do not use this".
* required means "you must use this".
* suggested means "it's a good idea to use this".
* optional means "you typically don't need this".

There is no combination that makes any sense. They are really
exclusive to each other.

Still we have to keep the three checkboxes for backwards
compatibility reasons. It was always possible (and will probably
continue to be possible) to have more than one of the three fields
enabled. While users like VisualEditor will make a good guess (e.g.
ignore the rest when "deprecated" is checked) I really think we
should not attempt to hide (and auto-fix) it in this dialog. That's
why the proposed code continues to show the old checkboxes when
more than one is checked.

Bug: T202851
Change-Id: I994268d658602761b180f489bedb50b91fe0c419
2023-11-16 14:06:06 +01:00
thiemowmde b8e437a38d Introduce prop var to reduce code duplication in Dialog.js
Most of the code is already using a "prop" variable for the same
purpose. I hope that following the same pattern everywhere makes the
code easier to read.

Change-Id: I00e344b9041e1cb7e2dee129b17549959f32e4d9
2023-11-07 11:48:08 +01:00
jenkins-bot aeb7f4eb4b Merge "build: Update linters" 2023-10-26 15:26:11 +00:00
Ed Sanders a180f5db36 editTemplatePage dialog: Fix typo in comment
Change-Id: I3db668ad01c2f78ca2c8873660b7685d7e6e6918
2023-10-26 13:58:38 +01:00
Ed Sanders 225e9ec1c0 Simplify multiline config generation
Change-Id: I4551c90ef8360d42c8b74848ce437e20bb792a55
2023-10-26 13:56:23 +01:00
Ed Sanders a53a1bfa5e build: Update linters
Change-Id: I1d32a8c331d7abae89d8fa539e0af4ee96935575
2023-10-26 13:52:08 +01:00
Bartosz Dziewoński f150c176e4 TemplateData editor: Use built-in 'allowLinebreaks' option
New in OOUI v0.48.2.

Unlike the old version, this also prevents inserting line breaks by
copy-paste and other methods.

Change-Id: I2fe1b7cfe70ebb6b66a9dfdf012522b574f6e774
2023-10-25 08:27:57 -04:00
thiemowmde 3c360bfeea Remove bogus updateParamDetailsLanguage call with no language
Turns out this was always pointless. Nothing the method does makes
sense without a language. A default language is only choosen much
later as part of getSetupProcess, and the method called a second
time, this time with a language.

Issue introduced a long, long time ago and finally surfaced via
Ifcbb877.

Bug: T238329
Change-Id: I47c8ce16107ebe7a1d955665dc890bef80ec892a
2023-09-25 14:42:01 +00:00
thiemowmde f302f65dbb Use correct BCP 47 language codes in lang="…" attributes
A small mistake made in I7a82143. This is only relevant for very few
(but critical) language codes. For example, the dialog allows to add
the MediaWiki code "zh-classical". This needs to be translated to
"lzh", but only when we use it directly in HTML.

Bug: T238329
Change-Id: Ifcbb877fb6a348937e85a82459e924548f5ca856
2023-09-21 17:33:41 +02:00
jenkins-bot 10e1c26580 Merge "Simplify client-side translateObsoleteParamTypes implementation" 2023-09-21 06:18:34 +00:00
jenkins-bot ae345d50ac Merge "Remove unused return true from addParam() method" 2023-09-20 14:17:31 +00:00
thiemowmde ef357ab4a2 Remove unused return true from addParam() method
It's always true and doesn't make any difference because of this.
I think the idea was to do some validation in the method. This
never happened and is done outside of the method instead (better
separation of concerns).

This is split from I1655174 to make it easier to review.

Change-Id: I48b7da75659365e5a2f72b680d40ee4b5b2904a2
2023-09-18 17:46:49 +02:00
thiemowmde aa0d7389ea Simplify client-side translateObsoleteParamTypes implementation
Reasons:
* It's not the job of this code to validate the incoming types. This
  happens server-side.
* The new code reflects better what actually happened: we stopped
  using the prefix "string/".
* This was not (probably never) in sync with the server-side
  validation. Some types got replaced, some didn't.

Change-Id: I0a35ca334c9e243dee548b271ddb3e1ca4498611
2023-09-18 17:31:12 +02:00
thiemowmde 8c4b970eab Use more consistent variable names in Dialog class
This is split from I1655174 to make it much easier to review. This
patch here doesn't do anything but rename existing variables to
follow existing, less confusing naming schemes.

Change-Id: Ibd9db5ca5a355246eeaed98d48edc835659ec2c5
2023-09-18 17:17:11 +02:00
thiemowmde 61ac3f9645 Remove unused lang argument from Dialog.updateParamDetailsLanguage
It's always `this.language` anyway.

Change-Id: Iaad6db9c5406c36307e827416ab8c08d80003f8b
2023-09-15 15:07:32 +02:00
thiemowmde 9eb2e46f37 Remove two messages that are unused since 2014
The "uneditablefield" was added in 2014 via I9b13e2f, apparently
as a temporary workaround. It was apparently not possible to edit
multi-lingual language object back then.

All code related to that was removed about 5 months later via
I985ea03. The patch made it possible to edit such fields. They just
forgot to remove the message.

The "actions" message was added via I863a819. Apparently used for
an "action" table column where parameters could be deleted. This
also got lost in the same big rewrite in I985ea03.

Change-Id: I57329bef8de10ee19e1904d33605d2102fd22741
2023-09-14 18:01:35 +02:00
jenkins-bot 491fed6bc6 Merge "Fix "Add new map" button overflowing in other languages" 2023-09-04 13:37:12 +00:00
thiemowmde eed932e3fb Add lang="…" and dir="auto" to inputs that support languages
The first patch I5f52fe3 worked only for fields with an existing
value. Turns out it's undefined for new fields.

Bug: T238329
Change-Id: I7a8214335b720c9ab738f6c4e47febbc0abf7dc4
2023-08-29 11:04:50 +02:00
thiemowmde 7650219451 Add lang="…" and dir="auto" to inputs that support languages
This might not be perfect but hopefully helps a lot already.

Bug: T238329
Change-Id: I5f52fe3b69c8477550d844cce18ab142e0ec6f4b
2023-08-23 14:11:08 +02:00
thiemowmde c3eb1abb90 Fix "Add new map" button overflowing in other languages
E.g. in German it says "Neue Zuordnung hinzufügen". The long string
peaks into the other UI elements because OOUI enforces some `nowrap`
for no good reason.

Change-Id: Ib5f8584d4ac652479d6f646dcaa8cf06654832fd
2023-08-23 13:59:03 +02:00
Ed Sanders 6107710ef1 Left align caption and put [Edit template data] inline
Bug: T339806
Change-Id: I69a46e64810edf458b8a8ee3e043f6dbc287c8aa
2023-08-05 15:13:22 +01:00
jenkins-bot 32475e3da2 Merge "Add missing keyboard navigation for param/language lists" 2023-07-14 07:04:31 +00:00
thiemowmde ded84d30b9 Add missing keyboard navigation for param/language lists
Bug: T324384
Change-Id: I73aa7b393129fe83f48d5b271cfb10ba0f4c2cff
2023-07-12 10:26:58 +00:00
Ed Sanders b296e1fc74 build: Switch linting to ES6
Disable no-var for now.

Change-Id: I9297112df4b73623cb167b60904a502abf86c526
2023-06-21 17:38:54 +01:00
jenkins-bot d5ec6c4a5f Merge "Fix incomplete validation & enter key when adding new parameter" 2023-05-26 12:38:26 +00:00
thiemowmde eb7fec0877 Fix broken ActionFieldLayout construction
OO.ui.ActionFieldLayout requires 3 parameters: 2 widgets and optional
configuration. But this code was passing only 1 widget. The config
object was actually used as a widget and never as config. It's a
miracle this was not throwing an error. ;-)

Replace with a more trivial FieldLayout which requires only 1 widget.

Also clean up some closely related code.

Change-Id: Idca9a39e9f442f3a5412027906de9f868fc12b76
2023-05-23 18:59:24 +02:00
thiemowmde 03feb0d2a7 Fix incomplete validation & enter key when adding new parameter
This fixes a whole sequence of issues:
* It was actually possible to add a parameter with no name.
* It was also possible to add parameters where the name is nothing
  but whitespace.
* Pressing enter was not possible.
* The button was initially enabled with the input field being empty.
* Validation code was duplicated, but incomplete, which made it
  possible to add duplicate parameters with enter.

Bug: T324381
Change-Id: I598997efc63256fd59a2b4f71fb7c3d99306bd85
2023-05-23 18:48:26 +02:00
Bartosz Dziewoński f2c89028bd Update TemplateDataEditor logging for IP masking
Bug: T332434
Change-Id: I9935e7d35b1cdb14c0958351cd84d9d6476d6363
2023-04-18 19:30:54 +00:00
Umherirrender 06d6054ade stylelint: Enable selector-pseudo-element-colon-notation
Via stylelint --fix

Change-Id: Iafee0799add6495119f174d3022af17206167c0e
2023-03-30 01:01:00 +02:00
thiemowmde 22d5363208 Fix placeholder size for the "edit template data" button
This placeholder was added in Ic8f9bf7. It makes sure the page
content below the button doesn't shift down the moment the button
appears. See T279869 for a screencast that demonstrates the issue.

Unfortunately something changed (possibly related to T323773) and
the size of the placeholder is not correct any more. At the moment
the page shifts up a few pixels.

Bug: T279869
Change-Id: Ie6e585d2061342c11aabb4414bb9b0bedecf3a12
2023-03-13 09:40:17 +01:00
Thiemo Kreuz ec72e43858 Move var declarations (and initializations) down in Dialog class
Note the code style in this file is already a mixture of some early
declarations and others that happen in place. We mostly prefer the
later nowadays because it makes the code much more readable. Some of
the code touched in this patch was really a little confusing, I would
argue.

Change-Id: Ib2777c6f6c86876c016e50d7bd2fe3d82c611914
2023-01-10 20:27:23 +00:00
jenkins-bot d1b7f188ad Merge "Reduce code duplication when switching dialog panels" 2023-01-10 01:41:11 +00:00
thiemowmde 73ec256285 Fix broken maps panel in TemplateData editor
A change in OOUI made .addItems() silently ignore non-array input.
The most robust fix is to make all callers follow the documentation
instead of relying on undocumented behavior.

The change to onMapItemRemove is not strictly needed but done to make
this piece of code much more robust.

Change-Id: I95f9a058766720d3809c3e56309326c2a91f2bcd
2023-01-05 16:47:00 +01:00
thiemowmde 8f6493a198 Reduce code duplication when switching dialog panels
Main change is that we don't map between strings and object
references any more but use the object references directly.

Change-Id: Iecc011f62089d902bb5cbd9ff3b4189d3258a2b4
2023-01-05 15:27:13 +01:00
jenkins-bot 9bca2b9d36 Merge "Set focus to first input field on all panels" 2023-01-04 19:17:52 +00:00
Thiemo Kreuz 7d0f0da623 Use type info instead of repeating individual field names
The data structure at the top of Model.js uses types like "string",
"array" and so on. Fields that share a type behave identical. I find
it odd to repeat parts of this data structure in the code. That's
what the types are for.

Change-Id: Iae55c18ececb809a56e40d3179d2cde357309d0a
2022-12-31 10:45:48 +01:00
jenkins-bot dda14a168c Merge "Fix copy paste mistakes and outdated code documentation" 2022-12-29 01:12:27 +00:00
jenkins-bot d24fc8ee2f Merge "Streamline code duplication in nested if in Dialog.js" 2022-12-29 01:01:27 +00:00