Commit graph

145 commits

Author SHA1 Message Date
WMDE-Fisch 67988452ab Add message on multipart content
Bug: T276574
Change-Id: Iff5c2fd4071dd03ca62c395cce4041dacb1c7ea6
2021-08-25 10:47:16 +02:00
WMDE-Fisch 53186fc231 Remove sidebar margin on single transclusion
Bug: T272482
Change-Id: I5696dbd469161b1ab1ede2bb3f49e6dd24b98521
2021-08-17 13:54:36 +02:00
Andrew Kostka a2135d524d Show sidebar controls only when multi-part content is present
Bug: T272482
Change-Id: I092438bc9c7d5569f758786ca6952beffdf37507
2021-08-11 15:00:59 +02:00
jenkins-bot aa868059ee Merge "Better name for ambiguous "empty" concept in the model" 2021-08-09 09:40:40 +00:00
Thiemo Kreuz 35080a8646 Better name for ambiguous "empty" concept in the model
This is really only about the methods name, but doesn't change
any behavior.

I realized we work with several different definitions of what
"empty" means. There are at least two significant definitions:

1. When a parameter's value is the empty string or identical
to the default value, the behavior of the template is the same.
It will use the default value just as if the user entered it.

The auto-value is a meaningful value in this scenario and can't
be considered equal to the empty string.

2. The context here is when the user presses the back button.
This will destroy all user input. But an auto-value is not user
input. It will appear again when the user realizes they made a
mistake. Nothing is lost.

Personally, I would not use the word "empty" to describe this
concept. Things like "containsUserProvidedValue",
"isCustomValue", "isMeaningfulValue", … come to mind. These are
all still a big vague. A "user provided" value can be identical
to the default or auto-value. "Custom" how? I went for
"containsValuableData" for now.

Bug: T274551
Change-Id: I2912a35556795c867a6b2396cbad291e947f0ed6
2021-08-06 15:11:44 +02:00
Andrew Kostka 21e9f5f0c4 Make the sidebar in the transclusion dialog responsive
Bug: T274554
Change-Id: I51e988e6fb0e50c9d542400471152807626539ea
2021-08-05 17:23:22 +02:00
Andrew Kostka 2f1cfdd187 Cleanup feature flags in ve.ui.MWTransclusionDialog
Change-Id: I6f6326c981da998b547a2a1990e26185763093ca
2021-08-05 17:00:27 +02:00
jenkins-bot cf17a1f191 Merge "Remove tooltip from template dialog title" 2021-08-03 15:29:10 +00:00
jenkins-bot e57daaad98 Merge "Minor JSDoc documentation fixes in template dialog code" 2021-07-29 12:13:17 +00:00
Thiemo Kreuz 014bc9369c Fix incomplete back button implementation in template dialog
Bug: T286783
Change-Id: Ie86e2c8c6a874fde11591286a83faba71a34430d
2021-07-16 14:54:09 +02:00
Thiemo Kreuz 092276009a Minor JSDoc documentation fixes in template dialog code
Change-Id: I3697e48697ab0910b90b418abbc370736589b6e1
2021-07-16 14:25:11 +02:00
Thiemo Kreuz 55a49195ba Add @private/@protected documentation to template dialog code
These tags don't do much, if anything. But they provide a hint
in which scope a method might be used.

Bug: T284895
Change-Id: I0b4bdd416ee89d26961c4ded4d8bbace8c57da76
2021-07-01 09:36:00 +02: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
Thiemo Kreuz eedef37c78 Remove tooltip from template dialog title
This reverts parts of I678bb24.

Brief history of this code:
2014: The dialog was designed to dynamically change the title.
      There was never a tooltip.
2016: A change in OOjs changed the behavior in VE. Now the initial
      title shows up as a tooltip. It never updates because VE
      does not know about this. The tooltip does not match the
      visible title.
2021: We revert to the behavior from 2014. We achieve this by
      bypassing the codepath that creates the tooltip. This is why
      ….title.setLabel() is used instead of ….static.title.

Bug: T276568
Change-Id: I346a904881c3a63186d6a80afdaf717688bab42a
2021-06-22 16:12:52 +02: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
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
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
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 6d101fb9d7 Merge "Extract "show all" to placeholder class" 2021-06-16 12:25:55 +00:00
jenkins-bot 09933c4905 Merge "Method for getting the currently selected element" 2021-06-16 07:22:28 +00:00
jenkins-bot 4c7f5ff805 Merge "Introduce a new class to encapsulate booklet inter-pane wiring" 2021-06-15 14:55:16 +00: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
jenkins-bot 3f4cfb0fd8 Merge "Rename "value" to "wikitext" in TransclusionContent… classes" 2021-06-11 14:10:24 +00:00
WMDE-Fisch 09d98669df Rename expand and collapse button msg key names
These are currently more confusing than helpfull. Also applied
alphabetical order.

Change-Id: I4d48f7bc28b403142a5818d1c7a062872afc660d
2021-06-11 13:16:44 +02:00
Adam Wight a2daf5f6c6 Method for getting the currently selected element
Continue refactoring booklet pane access.

Bug: T284632
Change-Id: I866f8550d269d05b40eaddf8abb4ed5be03f902d
2021-06-10 15:32:07 +02:00
Adam Wight 44035a2384 Introduce a new class to encapsulate booklet inter-pane wiring
Begin to extract the wiring between a sidebar and the content pane of
the template dialog booklet layout.  Eventually, this helper class
will present a high-level interface like "addPart(id)" and will take
care of creating the outline item, content page, and connecting
events.

Start very simple, take over the "focus" method.

Bug: T284632
Change-Id: I7bc73cc4386b99d95941fc6ed88ab5bd998de014
2021-06-10 15:30:51 +02:00
Thiemo Kreuz df419335bb Rename MWTransclusionDialog.setMode() to toggleSidebar()
This reflects better what the method actually does. This patch
is a direct follow-up for the renames started in Ib029fd4.

Change-Id: Ie3e87139a5c2f5ac196e0fcc02fb897fadc99177
2021-06-10 14:05:40 +02:00
WMDE-Fisch ecf317e0bd Fix message keys to show options in template dialog
The names of the messages keys are very confusing. The order was set
wrong during refactoring in Ib029fd48b393d2ab7d7cff6c842789e22989e944.

We should rename the keys in a follow up in sync with translatewiki.

Bug: T284649
Change-Id: I43794d80b7df7d00441cb583ca53bcab03999e65
2021-06-10 10:50:40 +00:00
Thiemo Kreuz 190237ee28 Rename sidebar state to distinguish from multiple transclusion
This dramatically simplifies the "mode" flag in
MWTransclusionDialog. The main reason to touch this code is:
The flag appears like it will be "single" when the dialog
contains a single template, and "multiple" when there are
multiple templates. But this is not true.

What the flag really does is show/hide the sidebar. The sidebar
is needed to be able to create multi-part templates. But a
dialog that already contains multiple templates can be set to
"single" mode (i.e. the user can collapse the sidebar), and
vice versa.

This patch focuses on private details inside of this class, but
keeps the terminology of a "mode" in some places. E.g. the
messages are not renamed to not cause unnecessary trouble for
translators.

Change-Id: Ib029fd48b393d2ab7d7cff6c842789e22989e944
2021-06-09 09:44:08 +02:00
jenkins-bot 2b0da3e338 Merge "Update template dialog title when multiple transclusions present" 2021-06-08 08:14:11 +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
Andrew Kostka 67e48a26ef Update template dialog title when multiple transclusions present
Bug: T276568
Change-Id: I530a6cd8aea4f9fcafe7a03fc5050883f1f4b37c
2021-06-04 16:48:05 +02:00
jenkins-bot 69676950b3 Merge "Much longer descriptions of template dialog related classes" 2021-06-04 12:00:46 +00:00
Thiemo Kreuz e13b0dae48 Much longer descriptions of template dialog related classes
The idea is to possibly rename some of these classes, based on
these descriptions. But this should be done in later, separate
patches.

Change-Id: I7f9e5b2382711b434d6dd618489fa3ed8b7a46b4
2021-06-04 13:17:59 +02:00
Adam Wight c49478de60 Template dialog button title toggles between Insert/Edit
Depends on whether this is a new or existing template transclusion.

Split from Ib9b76cac7cd57245e8db2ef10879069a86a6269e

Bug: T276568
Change-Id: I4d22e32fef067b640e9a9389deffaace736c3405
2021-06-02 12:00:15 +02:00
WMDE-Fisch 98b6cc8bc2 Don't update backButton visibility if not set
Bug: T283511
Change-Id: Idb9668e45c6820cbb631d7a8aac34e03cf788802
2021-05-26 08:47:52 +02:00
jenkins-bot a01b56bcf1 Merge "Invert template search result highlighting" 2021-05-17 12:30:49 +00:00
Adam Wight 9cac71676e Invert template search result highlighting
Bug: T275048
Change-Id: I50fc7407b4357e2cea9d5421d0de46a81d39c69d
2021-05-17 14:12:02 +02:00
Andrew Kostka b2aa35a90a Show a warning before resetting the transclusion dialog
Bug: T272355
Change-Id: Id97190a149ed7642eda82300eeee623e0debf528
2021-05-17 13:27:37 +02:00
Adam Wight f444610fbc Support isEmpty on transclusion dialog elements
Returns true if there is no meaningful user input yet.

Will be used in the next patch.

Bug: T272355
Change-Id: I4f88ce31662bbc46755f78d574c46b907581d438
2021-05-17 13:26:11 +02:00
Andrew Kostka b2c9b225bd Add back button to the transclusion dialog
Bug: T272354
Change-Id: I08c4a7db6239b485439bf547e3e8b4d6f7aeede8
2021-05-17 13:18:14 +02:00
jenkins-bot 71a4ad4f8e Merge "Template dialog bigger size uses "larger" preset" 2021-05-14 11:27:44 +00:00
Adam Wight 9607cb3ed0 Template dialog bigger size uses "larger" preset
Rather than invent our own size, we'll reuse the "larger" format and
tweak the dialog height to 90%.

Bug: T273971
Change-Id: Ibef85c1912267b14d83396b089b81934751a8328
2021-05-12 11:31:40 +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
Adam Wight ded8c40915 Optional feature makes the transclusion dialog bigger
When $wgVisualEditorTransclusionDialogInlineDescriptions is set to
true, the template dialog will use a larger format.

Bug: T273971
Change-Id: Iad3c3f4d65125c83e35414ce15f793f6a1b192ef
2021-05-03 16:53:27 +02:00
Akinwale Alagbe 2a581819ec Fix: Adding accessibility labels to Visual Editor template elements
Bug: T245669
Change-Id: I3b792ffde571047d9900920188e92634b8f50298
2020-07-06 18:46:59 +00: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
Akinwale Alagbe 2aeae1c3f9 MWTransclusionDialog: Set 'aria-expanded' on "Show/hide options" button
Adding the ability for screen reader to announce 
the state of the Transclusion dialog 
when the show/hide options button is clicked.

Bug: T248089
Change-Id: I89b86179bcb63376e480cb8df55e24b9d29df037
2020-03-19 19:43:14 +00:00