Commit graph

301 commits

Author SHA1 Message Date
thiemowmde 981054937d Streamline code duplication in nested if in Dialog.js
… by turning the nested `if` around and simplifying the remaining
parts a little. This patch is intentionally minimized. More
meaningful changes will be done in the next patch.

Change-Id: I56cfa5c8ac8ca29acd42bd71786f5433e884e1b2
2022-12-23 12:06:36 +01:00
thiemowmde e222666e1f Rename message not specific to suggestedvalues
This fixes a FIXME in the code.

Change-Id: I3302352d000d865f074ddafe479d3f1afa62e93d
2022-12-19 07:39:17 +00:00
jenkins-bot 310bf46cf9 Merge "Simplify some overly complex comparisons with undefined" 2022-12-16 22:51:30 +00:00
thiemowmde b4c960287a Unhoist a bunch of variables in Dialog.js
Previously, our eslint configuration required all variables
to be declared together at the top of the scope, but that
was changed, and declaring the variables where they are needed
is clearer.

Change-Id: I87e74ceadd5374a6ba6b7a4f8f49dca03a5c4bca
2022-12-16 09:31:46 +01:00
thiemowmde ca5a2f26ea Create dialog elements from "type", not from element name
The data structure in Model.js, starting at line #125, does have a
"type" property that's supposed to do this. What kind of input element
we need depends on the type. Repeating individual element names here
means we are duplicating parts of the data structure.

The mapping is unambiguous, i.e. the new code is guaranteed to do the
same as before.

This is a tiny cleanup patch in preparation for later changes.

Change-Id: I162dcd6f9a31f5ab2c6eb7027befd4736de40ca5
2022-12-16 09:29:20 +01:00
jenkins-bot 09677910fe Merge "Inline some trivial single-use variables" 2022-12-16 03:05:52 +00:00
thiemowmde b53d754639 Renaming misleading "type" variable
"children" is an array. See line #148 in Model.js. What's called "type"
here is just the numeric index in this array.

Change-Id: I73c190f754d113ac90f5df76fb8cc8b7a75fc927
2022-12-07 15:30:18 +01:00
Ed Sanders 678d95251b Add an "Edit template data" button to the TemplateData output
This button, similar to an edit-section link, will launch the editor
and immediately open the TemplateDataGenerator UI.

Bug: T316759
Depends-On: Idb5e3c51a22361e0d9916d3c31444daeff310ed2
Change-Id: Ieb575c499c16d87c28972a55662ef0bd9cb72c06
2022-11-08 13:36:38 +00:00
Thiemo Kreuz 685363d947 Set focus to first input field on all panels
* This is most notably when adding a new parameter. The cursor should
  start in the input field.
* Focus the first input field when editing a parameter, whatever that
  input field is.
* Focus the big JSON editor when editing a map.

Change-Id: I5a3df626810007e83bd2300b540df75bc1b8cac4
2022-09-23 11:20:45 +02:00
Thiemo Kreuz 4790aaed4e Inline some trivial single-use variables
There is sometimes a good reason to arrange code like this, especially
when the additional variable name acts as documentation and helps
explaining what's going on. I think this is not the case here.

Change-Id: I46f4a18a4f78f4b03cf063a226de3f43ba13b1a2
2022-09-23 10:35:03 +02:00
Thiemo Kreuz 2d55ab3e68 Simplify some overly complex comparisons with undefined
The short `|| defaultValue` pattern is very common in JavaScript.
Note that in JavaScript – in contrast to PHP – empty arrays and
objects are not considered "falsy".

Change-Id: I97935c4dc2276d48d53ade3f7b4fdc28b62d89ba
2022-09-23 10:31:19 +02:00
Thiemo Kreuz 61dce0bf00 Fix copy paste mistakes and outdated code documentation
This patch intentionally doesn't touch any code to make it as easy
to review as possible.

Change-Id: I3089bd09f38b3aaa6424e7e263d514625f63f9f1
2022-09-23 10:28:12 +02:00
Thiemo Kreuz 17d6c485bb Fix broken comparison when editing the template description
This was always comparing with the English description. The effect of
this was that the comparison was always false and the value always
set, even if it didn't change, resulting in unnecessary events being
fired. So this is only about performance but not really user facing.

Change-Id: Id7a46dbac81e2595478848bbf325eece21815bec
2022-09-23 10:25:09 +02:00
jenkins-bot 9251dd1c18 Merge "Add space between icon and text in formatting message" 2022-09-07 09:09:38 +00:00
Ed Sanders d2e72a252f Add space between icon and text in formatting message
Change-Id: Id0b8b36b8f2145847fafa8005bc6bdc7b3f98e55
2022-08-31 11:43:40 +01:00
Ed Sanders 64b8be314c Fix font size of "Manage TemplateData" button in vector legacy + 2017WTE
Change-Id: I26a7a0956d2bcce1700b583a2e8c684d4d72b948
2022-08-31 11:27:46 +01:00
Thiemo Kreuz d36356326a Make use of LESS features for more structured CSS
This patch includes two bugfixes:
1. The previous rule with a `p + p` didn't do what it was supposed to
   do. It was adding a margin after the 2nd, 3rd and all following <p>
   elements, but not between the 1st and the 2nd. It should have been
   margin-top instead. The approach in this patch is different and
   avoids the need to repead the 0.5em.
2. The red background color was not applied to the input fields any
   more because OOUI doesn't use <input> elements any more.

Change-Id: Ia57b742e8b3cd29c1f55cd7e918f26f70eebab18
2022-08-08 17:40:08 +00:00
Thiemo Kreuz f92fed31c7 Turn all TemplateData .css files into .less files
This patch intentionally doesn't do anything else. Later patches will
make use of LESS features.

Change-Id: I7ce7fdba12aa9f5fb49a752706b83f831632bed6
2022-08-08 15:29:03 +02:00
jenkins-bot bc064ce8a2 Merge "Fix CSS styling of the HTML rendering broken since 2016" 2022-08-08 10:38:39 +00:00
Thiemo Kreuz 8497d85a2d Fix CSS styling of the HTML rendering broken since 2016
Some time ago there was a little bit of custom CSS applied to the HTML
table rendering. This is broken since patch I74214ea from 2016. This
patch renamed all CSS classes but forgot to update the PHP code
accordingly.

I decided to not change the HTML rendering because these class names
might already be used in custom per-wiki or per-user CSS. Instead I
partly revert I74214ea.

Unfortunately, some of the styles are quite dramatic, don't look good
or just don't work. I decided to remove some. The argument is that
the HTML rendering looks the same for 6 years now. I don't see a good
reason to change it now.

In detail:
* Suggested values are not aliases and should not be rendered in
  gray.
* The message "no description" is rendered in gray and italics. But
  this was applied to the wrong DOM element and made everything else
  gray and italic as well.
* The color #777 is not readable, violating WCAG rules. While it's ok
  to dim aliases and such, it must be at least #555 or darker.
* The "nowrap" destroys the table the moment one of the parameters
  does have a longer name or alias. Let the browser handle this, as
  it did for 6 years now.
* Same for rendering aliases as individual, indented blocks. This
  makes the table unnecessarily big when there are many aliases, and
  just doesn't look right. Again, let's stick to what we had for
  6 years.

Change-Id: Idfa76eed6e2d68474c79d4674efce091cb031b66
2022-08-08 11:56:16 +02:00
Thiemo Kreuz bd0e348032 Fix JSON export to fail on missing "params" key
It's required via the spec. We should act as if it's always there,
even when the actual "original data object" doesn't contain it.

Bug: T307331
Change-Id: I129b0c77e701df6ebbdc39432360cea8f10575e8
2022-07-21 13:10:12 +02:00
WMDE-Fisch d1ffdc2b95 Remove $wgTemplateDataSuggestedValues feature flag
Feature is always enabled now.

Bug: T307188
Bug: T310684
Change-Id: Ic99c594ceec0020a6c9d20f0a4f10285b74ea9a8
2022-06-27 12:14:02 +02:00
Thiemo Kreuz ff7470e316 Add placeholder to avoid wikitext editor jumping down
Bug: T279869
Change-Id: Ic8f9bf7c95b42422dc4b477f9c752f5e89b20dc7
2022-04-25 08:42:59 +00:00
Ed Sanders ef6294074e build: Update devDependencies
Change-Id: I80bd6849b1616b9c94e75eddfbf5f476b799e07b
2022-03-13 17:17:03 +00:00
Thiemo Kreuz d3f00177ba Don't extract template parameters from <pre>
<pre> behaves very similar to <nowiki> in so far that whatever it
contains doesn't get parsed as wikitext. It might contain {{{…}}}
tripple brackets, but these aren't going to be activated as template
parameters.

Bug: T91326
Change-Id: I05c24e369d97c48161c565e2ef30969ec28c6a23
2022-03-03 21:20:40 +00:00
Thiemo Kreuz da8969812c Move getRawParams helper method to ApiTemplateData class
This method is not used anywhere else:
https://codesearch.wmcloud.org/search/?q=getRawParams

I tried to make the code a bit more readable. Notable:
* Make use of the return value we get from the preg_… function.
* {{3,} means "the character '{' 3 or more times". {{{+ does the
  same. Note the { doesn't need to be escaped when it's not
  followed by a number.
* At the end, it doesn't make any difference when we scan for
  optional closing brackets. The moment we find at least 3 we are
  done.

The test is intentionally not moved. This is something for a later
patch.

Bug: T301337
Change-Id: I55e31ceecea2ae7c35bcfbc2d641b35f751820db
2022-02-09 12:37:33 +00:00
jenkins-bot c8537793c1 Merge "Fix and update type hints in JSDoc comments" 2022-01-17 17:11:19 +00:00
Thiemo Kreuz 5f749c6418 Allow aliases to be integers in addition to strings
Parameter names in a template can be numeric. While it makes a lot of
sense to force a specific format in the TemplateData JSON (i.e. only
strings), it's inconvenient and confusing if numbers are rejected for
being "invalid".

Effects of this patch:
* The incoming JSON is allowed to contain numbers in the aliases
  array.
* However, the API normalizes these and forces all aliases to be
  strings, as it was always documented.
* The editor component accepts anything in the aliases array, but
  forces all aliases to be strings. Again, as documented.
* Note that it was never possible to use numeric keys in the `params`
  list. This patch is only about aliases.

At the moment this is a somewhat "hidden" feature. We might or might
not update the documentation to officially allow numeric aliases.

Bug: T298795
Change-Id: I32ea296b4520e7f21b03a1f6390db4f43b613bdd
2022-01-10 13:33:27 +01:00
Thiemo Kreuz e79f19f09c Fix and update type hints in JSDoc comments
Change-Id: Ib38d3c4eff7630bd3aed04beee33adc5ae2101f3
2022-01-10 11:48:42 +01:00
Adam Wight 709c89909f Remove comma-delimiting code
No longer needed as of I9450f70e705d9596c7e0d7545f9b5505fc4aae04

Change-Id: I342db496a1e3e0b6c4466dbdd62ee0d8d21258c0
2021-12-17 12:08:10 +01:00
Thiemo Kreuz f7771a22a6 Edit aliases via a proper widget instead of comma-separated
Bug: T285284
Change-Id: I9450f70e705d9596c7e0d7545f9b5505fc4aae04
2021-12-17 11:50:27 +01:00
Thiemo Kreuz 2b2033c6ec Fix serialization adding empty autovalue when not needed
The autovalue field appears to be the only one with this edge-case.
This is because all other fields are either multi-lingual and
processed by the `….allowLanguages` code path above, or because
of other special-case handling somewhere else.

The idea is:
* Non-empty values are always added.
* When the property (in this case `"autovalue": "…"` existed
  before, it's kept, even if it's now empty.

Bug: T295074
Change-Id: Ie4d9825b89edb4bbbbc4283dc48e9113e537869a
2021-11-29 10:53:35 +01:00
jenkins-bot da2077d5bc Merge "Fix parameter auto-detection picking up syntax elements" 2021-10-06 23:27:08 +00:00
jenkins-bot f16838ebc0 Merge "Remove small pieces of unused code" 2021-10-06 23:05:34 +00:00
Ed Sanders da93a0fffa Move var declarations inline
Change-Id: I177f91e67ea2ea2ab07d64002ae80365fabdedd3
2021-10-05 17:37:33 +01:00
Thiemo Kreuz 3060559d1d Fix parameter auto-detection picking up syntax elements
See T290322 for a detailed description.

Bug: T290322
Change-Id: Id9935482fb466e7a1f6e55f042b13fe5851412d0
2021-09-03 13:18:42 +02:00
Thiemo Kreuz 4766216948 Remove small pieces of unused code
Mostly unused variable initializations. Note I'm inlining some
`var` keywords in this patch. This is in line with the current
style guides. See for example the discussion in I4f198e2 (search
for "hoisted" in the comments). However, I'm not changing the
entire codebase, as this is not the goal of this patch and also
just not necessary at this point.

Change-Id: Ibd80566c44584851ee2530d6b16dd28eb3db6bfe
2021-08-28 12:10:22 +02: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
Thiemo Kreuz f6e1004720 Various minor JSDoc/PHPDoc documentation fixes
Change-Id: I537bf4086058a7e18c9118f7433090c4bfaf98e7
2021-07-12 11:47:55 +02:00
Ed Sanders f567bb1b51 Avoid fit-content, not supported by all browsers
Bug: T282285
Change-Id: I59e4f5aaa3f4bdd1d97d90fcb671454b00777922
2021-06-03 21:53:40 +01:00
WMDE-Fisch 75ca02c746 Inline fix for suggested values on unkown paramter types
Follow up to I33625eb38047fdbd2ca9d026c056f263e228e7df implementing
Thiemo's suggestion.

Bug: T280688
Change-Id: I63e804e2b122d7471a2f1c603b9734f820820e72
2021-04-23 10:14:01 +02:00
Andrew Kostka 6fd0857012 Fix suggested values not being shown when the param's type isn't specified
Bug: T280688
Change-Id: I33625eb38047fdbd2ca9d026c056f263e228e7df
2021-04-22 10:18:44 +02: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
Adam Wight e9e1b8ff48 Send title without namespace
These are a mess and hard to de-localize.  Also, the schema is
already documented as not including the namespace in this field.

A proper migration would be very difficult, so we'll have to remember
that our data includes this glitch and manually strip namespace
prefixes before the deployment date, as needed.

Change-Id: If2a4dd865b95458dc63162460f252500fd52436e
2021-02-18 18:27:53 +01:00
WMDE-Fisch 43e3043bab Allow input fields for parameter values to expand
Adding a new widget that inherits from MultilineTextInputWidget but
is initialized with only one row and prevents using the return key
to add new lines.

Bug: T263533
Change-Id: I5423f5f04075d21abd7acf09b622fd6444feeeb2
2021-02-17 17:27:54 +01:00
jenkins-bot e474d1632d Merge "Update a few confusing variable names in editor code" 2021-02-13 17:24:02 +00:00
Andrew Kostka d81226fdf7 Bucket the user's edit count before logging an event
Bug: T272569
Change-Id: I5313a3808b266bb60644b40bdb192db77208774a
2021-01-21 13:52:28 +01: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
Andrew Kostka dfa86a7c71 The parameter-type-change event should also fire if type was initially undefined
Bug: T260343
Change-Id: I26f50dfd6b4b747b1ef88d619df6aff5278d412a
2021-01-08 14:09:34 +00:00
jenkins-bot fe3ee9ab6b Merge "Track parameter property changes" 2020-12-09 10:41:03 +00:00
jenkins-bot 248d4dfd9e Merge "Drop unnecessary top-level closures" 2020-12-07 15:34:32 +00:00
Thiemo Kreuz d08a6448e9 Track when (relevant) changes are made to <templatedata> tags
Bug: T267926
Change-Id: I55f72500b7bad7e648238560b516e870bc9130c8
2020-12-07 15:34:13 +01:00
Adam Wight 93b7bc0756 Drop unnecessary top-level closures
Change-Id: Ie8fbde864cd08f0657e4239f525ef9dd087aee41
2020-12-07 15:24:31 +01:00
Adam Wight 80021704d4 Track parameter property changes
This is temporary interaction tracking to better understand how the
dialog is used.

Bug: T260343
Change-Id: I14afa89e18676818f88c142059128a9f62dcadcb
2020-12-07 14:39:05 +01:00
Adam Wight eb6b61b3a7 Rename "property" variable for clarity
"props" sounds plural, but it is the name of a single property.

Change-Id: I62184d00d03e297568e1c335f31c961aa6983406
2020-12-04 18:44:48 +00:00
Adam Wight 5206188129 Assign reused dependentField value to a variable
Change-Id: Ie77fd61d5bb7d886ab069472d0294daf4039d4e2
2020-12-04 18:44:40 +00:00
Adam Wight 8e65e4d8fb Assign reused propertyInput value to a variable
Change-Id: Ic8ea8ae283112801266303eb1d2520931e47a418
2020-12-04 18:44:32 +00:00
Adam Wight 415286e377 Send metrics for template property interactions
Bug: T260343
Change-Id: I050eb4b87ccb9c8910847b929b86c3b3cb269b8a
2020-12-04 18:44:01 +00:00
Adam Wight 1d108b5104 Send metrics when applying changes
Bug: T260343
Change-Id: I6fea4195107baf301dd8f66967c86e9c7a762bd1
2020-12-04 18:43:30 +00:00
Adam Wight d8e418671d Send metrics when opening the dialog
Distinguish between create and edit.

Bug: T260343
Change-Id: I5cd29dff0c4db7e024395a9090c465a01527f079
2020-12-04 18:43:23 +00:00
Adam Wight a9a4485b22 Higher-level distinction when creating new TemplateData
This is needed for metrics collection.

The patch shifts responsibility for filling out an empty record when
there is no existing TemplateData, or it's corrupt.

We could clean up further by making logic robust to missing `params`
in the original templatedata, so that an empty structure is simply
`{}`.

Bug: T260343
Change-Id: I6ddc2660257890290cd40c54f9c8507ab5206d6c
2020-12-04 18:43:09 +00:00
Adam Wight b7fee749ab Migrate to package files: ext.templateDataGenerator.editTemplatePage
Change-Id: Ie03284701c1870b06116b7ce6a8ca1759c28d03b
2020-12-04 19:41:50 +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
Adam Wight 1010e6fb78 Migrate from jsduck to jsdoc
Bug: T138401
Change-Id: Iae74fdcae5e8c2541416d8cec8de8221cfc282ef
2020-11-30 21:56:30 +01:00
jenkins-bot 2a477094b9 Merge "Add progressive flags to various buttons" 2020-10-09 14:38:33 +00:00
jenkins-bot bb8e099e4a Merge "Remove unused "changesBooleanValue" property" 2020-10-07 17:04:52 +00:00
jenkins-bot 27e9916941 Merge "Use OutlineSelectWidget/OutlineOptionWidget for maps editing" 2020-10-07 10:06:55 +00:00
jenkins-bot 86a6865512 Merge "Fix parameter extraction from wikitext source" 2020-10-06 23:07:23 +00:00
jenkins-bot a0f98a1ea4 Merge "Also add padding to add parameter panel" 2020-10-06 23:02:38 +00:00
Marielle Volz 8a4e0ec984 Also add padding to add parameter panel
Follow up to Ica6bed595d8

Change-Id: I43d76ac256f18b69b556eadf5a53c20698cd860d
2020-10-06 09:37:09 +01:00
Ed Sanders c61049b8e3 Add progressive flags to various buttons
* Add '+' icon to "Add parameter" footer action
* Add "primary" action to button on add param page

Change-Id: Idc5f83afdbffb2336c6949fcd16a08a00e28a1a3
2020-10-06 08:26:43 +00:00
Ed Sanders 91214f0a6f Use OutlineSelectWidget/OutlineOptionWidget for maps editing
Change-Id: I90ab11c9a0941e8a487a7253d69f0a6cb1dc8dc5
2020-10-05 21:04:44 +00:00
Ed Sanders a990bcfc54 Move sub-page warning to dialog when opened
This is an important warning, and should not just be hidden.

Instead show it in the dialog as well in case the user ignored
it on the edit page.

Change-Id: If6f2d4b15157096a915186921d767a860edbc86a
2020-10-05 19:37:59 +01:00
Ed Sanders 39ba318938 Use MessageWidgets instead of LabelWidgets in Dialog
Change-Id: Ia9c34f446d4af7c2f56903ee83b6a57c4ef100dd
2020-10-05 19:37:59 +01:00
jenkins-bot e729bc7d84 Merge "Use a MessageWidget for the sub-page warning" 2020-10-05 14:48:20 +00:00
Ed Sanders d79e07f059 Remove default padding from panels, uses padded:true/false instead
Change-Id: Ica6bed595d8f1b2ac7cb6f30d3081536b7e8561b
2020-10-04 15:53:15 +01:00
Ed Sanders 2d55fa64b1 Use a MessageWidget for the sub-page warning
Change-Id: I8b2878a9a817d14d3a4542a083e98a9f70cfde8d
2020-10-04 14:05:26 +01: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
Thiemo Kreuz fa7d16a373 Update a few confusing variable names in editor code
Change-Id: I8e7bc84539e62784059e0a43ca3de48c31abe6cf
2020-09-18 15:50:51 +02:00
Thiemo Kreuz 47e8249349 More canonical property order in mw.TemplateData.Model class
This does not have any effect on how this code behaves. It's
only relevant when a human reads the code. I tried to bring the
properties in an order that makes the most sense, grouping stuff
that clearly belongs together, as well as following how stuff is
ordered on
https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: Ibbe1027023f8d87bbd0a70411882a25671918670
2020-09-01 09:10:34 +00:00
jenkins-bot c42a4afede Merge "Allow different maps to be edited separately" 2020-08-30 16:14:59 +00:00
Khatean 76cf63dad2 Allow different maps to be edited separately
Seperate different maps of maps-object into different panels that
contains text-area to edit the map, delete button to delete the map, and
can be navigated through using a side-bar, that also have "Add new map"
button at the top to add a new map.

Bug: T258820
Change-Id: Ib53a73203f6010b3fd8a5cd78c74c904be2340f2
2020-08-28 20:18:27 +02:00
Thiemo Kreuz 4853c2ae3a Remove unused "changesBooleanValue" property
Not used anywhere:
https://codesearch.wmcloud.org/search/?q=changesBooleanValue

Change-Id: I40f08f4d7164dbcb7bef58bb647607573f852f15
2020-08-25 14:18:54 +02:00
Thiemo Kreuz a5fe1bfbb9 Move "Unknown" type to the top of the dropdown
"Unknown" is the special, default value when nothing else is
specified. It feels wrong to find this in alphabetical order
between all the other values, as if "Unknown" is something I'm
expected to pick. While this is possible, it's almost never
necessary. "Unknown" is the default anyway. If I'm fine with
that, I never change it. But if I want to pick something else,
I typically expect the list to show the "nothing selected yet"
default first so I can easily avoid it.

Change-Id: I283a1b0545efba208af777a0b2056740263dfc32
2020-08-19 17:30:05 +02:00
Siddharth VP 512911b92e Make getRawParams() ignore parameters in comments and nowiki tags
This is used by the includeMissingTitles option of API action=templatedata.
Parameter syntax existing within nowiki tags or comments will not be valid
for the template.

Bug: T237195
Change-Id: Ibbfa3e21488f2a37fc494862e929baf50607d4c9
2020-08-17 00:33:06 +00:00
Ed Sanders 71b27ed1ba Set import button to display:block, fixing text overflow
Bug: T259348
Change-Id: Ibbe2ccef8062275a20200445279033e084ca12aa
2020-07-31 14:19:43 +01:00
adham-khatean c4ca729ed5 Make the maps object editable from the TemplateData dialog
- Enable multiline.
- Enable updating the model with user changes if user clicks "Done".
- Disable "Done" button if the user inserts invalid JSON to handle JSON errors the
user might cause, and "Done" is enabled again if the JSON is valid.
- Create "cancel" button/action which will be for maps panel only, to
discard all changes made by the user.

Bug: T257503
Change-Id: Icd495290bae0b1684f8cd53864904a35e60fffe7
2020-07-24 16:07:04 +02:00
jenkins-bot 821c3b5af2 Merge "Create initial UI for maps panel in TemplateData GUI" 2020-07-09 19:12:27 +00:00
adham-khatean e719555d30 Create initial UI for maps panel in TemplateData GUI
Adding maps object to TemplateData GUI. By adding mapPanelButton to the
main panel and creating the map panel which contains multiline input
widget to show and insert the map info.

Bug: T254478
Change-Id: Iacff86812cbc448fcdbae24e7eeffb0384781dd5
2020-07-09 19:13:29 +02:00
Ed Sanders bf67ec6d52 build: Update eslint-config-wikimedia to 0.16.2
Change-Id: Ib53aa55795f228768a6226eebfdb5734d8a976d1
2020-07-08 13:08:35 +01:00
Thalia 8361c80307 Disable TemplateData dialog 'apply' action until changes are made
Change-Id: I890de938654ea598d3f7af2ea7f69e11188bbab4
2020-03-30 23:39:26 +01:00
adham-khatean 1bf9e95bb6 Fix borders for alias pills in TemplateData editor
fixing the problem of top and bottom borders for the alias pills in the
TemplateData editor are cut off, by setting the padding of the
class "tdg-templateDataParamWidget-param-aliases" to 1px

Bug: T248486
Change-Id: Ic66cda0be840fb3be966c2efa89062b7b9f117a3
2020-03-30 15:53:08 +02:00
Timo Tijhof 53f4783ffd Organise resource files in directories after their module bundles
* I've moved the one remaining file in resources/ to modules/.
  The repo had both resources/ and modules/.

* Class files are named after their class.

* Files with init logic on a page are named init.js.

* Files that only export re-usable classes for another module,
  are named index.js.

Bug: T193826
Depends-On: If661c68bea069e99cfff35711efdde7805a12851
Change-Id: Ic8975d7ba349ba50f9039545d2eb8d912ccdce26
2020-03-15 15:21:39 +00:00
Bartosz Dziewoński 2a137a2377 Ensure cancel confirmation dialog is visible on top of main dialog
Bug: T241819
Change-Id: I7764ad13acd52779e4f4ae853c05c795a80dc870
2020-01-03 12:57:30 +01:00
Ed Sanders 2db15c75a1 build: Update linters
Change-Id: Ie5cd0d355017eb802d0b302a69248886409fcbf9
2019-12-18 11:43:42 +00:00
Bartosz Dziewoński 2b8e39a278 templateDataGenerator: Fix off-by-one error when inserting new tag
There should not be a `- 1` here. It was kept in the refactoring in
34924e0a0b, but it should have been removed.

Also simplify the entire expression to just `matches.index`, which is
equivalent and easier to understand. We already use `matches.index` above.

Bug: T239445
Change-Id: I9cbeaabd50fb595c0ff622b86ce3870285e5b7c8
2019-11-28 21:39:32 +01:00