Commit graph

589 commits

Author SHA1 Message Date
Thiemo Kreuz 0bd9e587b3 Basic cursor key support in new template dialog sidebar
Bug: T285323
Depends-On: I47effe05427cfabfcf534920edee79521eaa033f
Change-Id: I319896a20a71b18655ebb93663d47e656a1a67a6
2021-08-26 12:48:49 +00:00
jenkins-bot e803c20007 Merge "Rename …ParameterCheckboxLayout now that it's an actual Widget" 2021-08-23 14:46:09 +00:00
Thiemo Kreuz 5fcc862eb1 Remove dependency from new sidebar to the BookletLayout
This replaces I8cf9ecd.

Significant changes:
* The …OutlineContainerWidget doesn't need to know the
  BookletLayout any more. The only remaining resason to have
  this dependency was some focus management. This is now done
  via an event.
* Renamed an existing event to match the new one. The two
  really mean and do the exact same, even if they are
  triggered from two different places.
* Simplified some existing code.
* Updated documentation.

Bug: T288827
Change-Id: Ifcf2cadabf7fa4b8ecb72e3937003fab3b00d9bb
2021-08-20 10:07:03 +02:00
Thiemo Kreuz 4f9426d61a Rename …ParameterCheckboxLayout now that it's an actual Widget
This is a direct follow-up for Idc5e048.

Bug: T285323
Change-Id: Ia03d594386a9a59a4819bf78c7d2edcd465dfd52
2021-08-20 09:56:40 +02:00
jenkins-bot eaeaf7240a Merge "Rename custom outline widget events to not conflict" 2021-08-19 13:49:29 +00:00
jenkins-bot 834d7fee77 Merge "Rename conflicting .setSelected() method in outline widget" 2021-08-19 13:46:24 +00:00
jenkins-bot 2326468533 Merge "Remove unused code from ve.ui.MWTransclusionOutlinePartWidget" 2021-08-19 13:43:26 +00:00
Thiemo Kreuz 095c891040 Remove unused code from ve.ui.MWTransclusionOutlinePartWidget
* getPartId() is unused.
* Use this.data instead of a custom this.partId.
* No need to store this.header as a property.
* Rename the event to "headerClick". That's enough when the
  event comes from a widget that does have the word "part" in
  it's name.

Bug: T274544
Bug: T288827
Change-Id: I8c70425403c6cd6a19e3a1cacb2b085e5c8b2e46
2021-08-19 11:03:44 +00:00
Thiemo Kreuz 3365c0fd66 Rename custom outline widget events to not conflict
The base widgets we are going to use (notably OO.ui.OptionWidget
and OO.ui.SelectWidget) also have events, and some of them use
the same names. Such conflicts are really hard to track down.

This is meant to be temporary. The goal is to use the events
from the base classes and get rid of the custom ones, if
possible.

Bug: T285323
Change-Id: I0f103a5bbb8fb800e57009e3bf709f00a651fdda
2021-08-19 09:55:11 +00:00
Thiemo Kreuz 68712e979b Rename conflicting .setSelected() method in outline widget
The problem here is that the OO.ui.OptionWidget base class
(changed in the previous patch) also contains a .setSelected()
method, but with slightly different behavior. This results
in crazy behavior when I try to make the outer widget an
OO.ui.SelectWidget.

Renaming the method to be a custom, private helper method
avoids this problem.

The plan is to actually use the default setSelected()
behavior and get rid of the helper method. This will be done
in later patches.

Bug: T285323
Change-Id: I84e752f20a4d07007fd4e61989f9b34983410950
2021-08-19 09:54:55 +00:00
jenkins-bot 68cfd5da16 Merge "Remove addParameter button from new sidebar" 2021-08-18 09:34:26 +00:00
Thiemo Kreuz 220c98ab44 Make template parameter checkbox widget an OptionWidget
The plan is to change the outer …TemplateWidget (which contains
a list of template parameter checkboxes) into a SelectWidget.
But this requires the elements in the list to be a subclass of
OptionWidget.

Note this change does not have any effect, as of this patch. But
this makes the following patches smaller and easier to follow.

Additionally:
* The OptionWidget class is already a LabelElement. No need to
  initialize this twice. This happens via the parent constructor
  now.
* Remove CSS that is not needed any more after Idc5e048. This is
  not a FieldLayout any more.
* Update some related code documentation.

Bug: T285323
Change-Id: I92e8fd2bbece9e6c55083cdfe6ed7ad16a64d688
2021-08-18 11:11:41 +02:00
WMDE-Fisch 891814d12c Remove addParameter button from new sidebar
Bug: T272487
Change-Id: Ie790a056f16727a89199f9737862281e0ac455a3
2021-08-18 09:22:43 +02:00
jenkins-bot d417d3709b Merge "Use the "wikitext" for content in transclusions" 2021-08-17 13:32:37 +00:00
Thiemo Kreuz 7503b323b1 Stop re-creating template parameter pages over and over again
This is what actually happens:
* We call `addParameter()`.
* This triggers an `add` event.
* This calls an `MWTemplateDialog.onAddParameter` event handler.
* This code doesn't check if a parameter already exists (because
  it shouldn't). It detroys the page in the content pane on the
  right and recreates it from scratch.

The only reason we do this is to focus the input field on the
right. This patch introduces a dedicated event to do this.

Bug: T288827
Change-Id: I47effe05427cfabfcf534920edee79521eaa033f
2021-08-17 13:34:41 +02:00
WMDE-Fisch 199d9536d1 Use the "wikitext" for content in transclusions
Bug: T272482
Change-Id: Ibe68b49c25b4f0d88483c22e0e4b8462d935a45b
2021-08-17 13:06:49 +02:00
Thiemo Kreuz 88ebae9b0f Remove unused properties from template part widget classes
It doesn't look like we are going to need these.

Bug: T288827
Change-Id: I0bcc1aea85ce589db814a1bed12226d47728d7e9
2021-08-16 14:52:54 +02:00
jenkins-bot 5c9bfe6a33 Merge "Make checkbox element in the sidebar an actual widget" 2021-08-16 12:36:40 +00:00
jenkins-bot c3ff9df19e Merge "Basic keyboard navigation in the new template dialog sidebar" 2021-08-16 12:36:37 +00:00
jenkins-bot ddfde5f3b6 Merge "Remove duplicate class property from checkbox layout" 2021-08-16 11:56:16 +00:00
jenkins-bot eb0e2cd507 Merge "Change filterParameter(s) event to work with a list" 2021-08-16 11:10:09 +00:00
jenkins-bot 41c286c68c Merge "Rename ambiguous "add button" click handlers" 2021-08-16 11:01:36 +00:00
Thiemo Kreuz d1f87646df Make checkbox element in the sidebar an actual widget
This should not have any effect on how the thing looks and
behaves.
* All elements in the sidebar should be reachable with the tab
  key, including disabled elements.
* Enter jumps to the corresponding paremeter in the content
  area on the right. But enter doesn't change the checkbox
  state.
* Space canges the checkbox.

The class will be renamed in the next patch.

Bug: T285323
Change-Id: Idc5e04828ece0ba77a65e4c839cd3ffccc3b6733
2021-08-11 09:12:00 +02:00
Thiemo Kreuz 0bbcb436c1 Change filterParameter(s) event to work with a list
As discussed in Ia44da16. This change avoids possibly hundreds
of events (when a template does have hundreds of parameters),
and replaces them with a single one.

Bug: T288202
Change-Id: Ic819e8c93e872b653c238f396f1f327b6a8759d2
2021-08-11 08:06:22 +02:00
Thiemo Kreuz f32a062e3f Basic keyboard navigation in the new template dialog sidebar
There is still a lot to do, but this implements some basic
behavior that was missing before.

* You can now use the tab key to navigate all checkboxes,
  including disabled ones (required parameters).
* Enter key now works on both the checkbox as well as when
  the entire line is highlighted. Enter forces the checkbox
  to be checked and moves the focus to the content area.
* Mouse clicks now work on the entire line. Before, only the
  text label was clickable.

Open issues (not to be resolved in this patch):
* Clicking the text label and the empty space after the text
  label does different things. Probably shouldn't.
* Should a click on the label check the checkbox?
* Space key should probably not move the focus to the content
  area.
* Focus rectangle is different on disabled rows. Is this ok?
* Background color when a line is focussed is missing.

Change-Id: I22ccd1bea92e4f098d4b25a9e38cddde5c103423
2021-08-09 18:38:28 +02:00
Thiemo Kreuz 984a3a1ebf Remove duplicate class property from checkbox layout
The checkbox is the first parameter in the parent constructor.
The parent is the FieldLayout class. The checkbox becomes the
this.fieldWidget in the parent class. Just use this instead of
storing a duplicate reference.

Bug: T274543
Change-Id: I4ae7d467334f88f2be93a62660145a025089401f
2021-08-09 18:31:30 +02:00
Thiemo Kreuz 2ce7bb0213 Split long ve.ui.MWTransclusionOutlineTemplateWidget methods
This direct follow-up is meant to resolve the change request
from I1b0480a.

Bug: T274551
Change-Id: Iee4bab0b9807e6d36435d31bf8ec879d13d9ad3b
2021-08-09 10:40:53 +00:00
Thiemo Kreuz 6446cf950f Fix off-by-1 error when deprecated parameters are hidden
This is a direct follow-up to I6ebd020.

Steps to reproduce the bug:
* Make sure you have a template with a deprecated parameter.
  The position doesn't matter.
* Add the template. The deprecated parameter is hidden.
* Add an undocumented parameter, e.g. "b". This is added to the
  end, as it should.
* Add an undocumented parameter "a". This should appear before
  "b", but doesn't. The reason is because the invisible
  deprecated parameter is in the list that is used to calculate
  the index, shifting it by 1 (or more when there are more
  hidden parameters).

This patch includes a few closely related changes:
* We can loop the list of checkboxes directly instead of
  indirectly via the list of parameter names.
* I made it so that an active filter only resets if it would
  hide the new parameter. The original problem we had to solve
  was that the new parameter would always be visible, even if
  it doesn't match the filter. This awkward mismatch is still
  guaranteed to not happen.

Bug: T274551
Change-Id: I1b0480ae836cc19b77b159d3fb30ff32e8c59df4
2021-08-06 12:24:49 +00:00
Thiemo Kreuz 3e5a2d6c82 Filter right content side of the template dialog as well
I came up with a new event to do this. This event is triggered
individually for each parameter. An alternative is a single
event that gets a list of visible parameters. Is this better?
What do you think?

Bug: T288202
Change-Id: Ia44da16917c28171a01aef0f1c613dcd5d3266ba
2021-08-05 14:36:10 +02:00
Thiemo Kreuz f37814ba61 Rename ambiguous "add button" click handlers
Change-Id: I25fd1430443feffcc3fb17115dc4129890063c48
2021-08-05 10:51:26 +02:00
Thiemo Kreuz 5e2a898459 Don't offer deprecated parameters when they aren't used
This affects only the new sidebar. Deprecated parameters don't
get a checkbox, except they are used already. "Used" includes
parameters that are present, but empty.

Bug: T274551
Change-Id: I6ebd020d02650c19060345d13495373acab363df
2021-08-04 16:34:54 +02:00
jenkins-bot 98aeab538b Merge "MWInternalLinkAnnotationWidget: show disambiguation pages last" 2021-07-28 03:00:52 +00:00
MusikAnimal 4fbab29e22 MWInternalLinkAnnotationWidget: show disambiguation pages last
Disambiguation pages are rarely the page users intend to link to,
especially with newbies. By moving the disambig page(s) as the last
result, the user is more likely to pick the page they actually intended
to link to.

Bug: T285510
Depends-On: I2b8545f6dd4849629037f81f48a540748e60da83
Change-Id: Id55a19e7665d8f88559c471de36e5447fb2babb0
2021-07-27 18:36:50 -04:00
Andrew Kostka ef33a908a0 Dynamically set the visibility of the sidebar search
With this users can also filter undocumented parameters
that they added to an empty starting template.

Bug: T272481
Change-Id: I99adb38b0ae4d4ade91fcb506f10c0222b9bb5e8
2021-07-20 13:11:08 +02:00
Andrew Kostka 6cec42f8dc Don't reset the sidebar search field if the search widget is undefined
Bug: T286987
Change-Id: I66116ea08d4682e179e9eb70d117454194e3517d
2021-07-20 12:08:00 +02:00
Andrew Kostka d44bc19d20 Adjust the styling for the template parameter search
Bug: T272481
Change-Id: Ie1c6b95cf32640401cb2a17bcda656a40a22e9b4
2021-07-16 18:03:48 +02:00
jenkins-bot 317b78782e Merge "Make it possible to reuse existing transclusion outlines" 2021-07-16 14:25:24 +00:00
jenkins-bot 4cb9b05668 Merge "fix order of sidebar elements" 2021-07-16 14:15:16 +00:00
Svantje Lilienthal 2f4e73d6ed fix order of sidebar elements
Bug: T272481
Change-Id: Ifd925bd6e8b972fd5d4e851c3a39a91aeac97d43
2021-07-16 15:10:56 +02:00
Thiemo Kreuz 5c6d2212da Make it possible to reuse existing transclusion outlines
Note that this patch alone probably does not make that much
sense. The code executed is pretty much the same. The only
difference is that the empty (!) …ContainerWidget is kept
and re-filled with what might be a completely different
template.

This is not much of a difference to before when the
container was recreated.

This change will make more sense when the container has to
manage more state, e.g. focus states. This state will
survive then.

Change-Id: Ic336d10a595e3e222741a3dc57c1d54639166b7a
2021-07-16 14:43:31 +02:00
Thiemo Kreuz 434c11f6de Fix incomplete template dialog event handling in new sidebar
Notably:
* Don't require the model in the new sidebar via dependency
  injection, but connect the event handlers later. This is
  relevant because we currently create the new sidebar in the
  wrong spot. Removing the hard dependency allows us to split
  the code and utilize initialize() and getSetupProcess()
  correctly. This will be done in a following patch.
* The change event now includes the new position. This makes
  it very easy to add this missing feature to the new sidebar.

Also:
* Stop triggering change events when nothing changed. These
  events are expensive. They bubble all the way up to the
  TransclusionModel, and to all linked
  onTransclusionModelChange() handlers.
* Update event documentation to make this more visible.

Bug: T274544
Change-Id: Iafe29f18a6fed14d9c3124c9756aa840886afbbc
2021-07-16 11:29:26 +00:00
Thiemo Kreuz 1164f67f40 Tweaks and cleanups to template parameter search
Notably:
* Include parameter aliases, labels and descriptions in the
  search.
* Don't use a possibly outdated search index, but live data.
* Clear filter when a new checkbox is added.

Bug: T272481
Change-Id: Ie90a803af6178a8bb6de370a0f8e079800d9f8a2
2021-07-16 12:11:13 +02:00
Svantje Lilienthal 066c663864 Add parameter search to sidebar of VE TemplateDialog
Bug: T272481
Change-Id: If044e5d134f1b24f939c4786949e6ca34fb79e1e
2021-07-16 09:48:29 +00:00
Thiemo Kreuz 766b220f5a Finishing touches to new template editor sidebar
In detail:
* Allow clicks on all elements in the new sidebar. This should
  focus the corresponding element on the right.
* Make all elements in the new sidebar tabbable.
* Fix MWTransclusionOutlineTemplateWidget.createCheckbox() to
  not need a temporary param object any more.
* Rewrite more code in MWTransclusionOutlineTemplateWidget to
  be shorter and easier to read.
* Fix MWTemplateModel.addParameter() to not do way to much
  stuff when a parameter already exists.
* Update code documentation.
* Use more specific, less ambiguous variable and method names.

Bug: T274544
Change-Id: Iaf6f7d1b0f7bf0e9b03eb86d01f3eceadece6fe4
2021-07-15 08:40:35 +00:00
Thiemo Kreuz ff9f8a9e2d Focus template editor elements on click in the new sidebar
Clicks on the left side now focus elements on the right
side.

This patch also simplifies the …ContainerWidget constructor.
The config parameter should only be used for "OOUI things"
that are needed by subclasses and mixins. But the parameters
we have here are not "UI things".

Passing them as config passes them to classes where we don't
know what they do with it. What probably happens is that
some class keeps a reference to the entire config object,
which doesn't have a benefit and possibly blocks garbage
collection.

Bug: T274544
Change-Id: I0c0e4a1ba59dcb43141338ffe939c9c6783e000d
2021-07-15 08:40:28 +00:00
Thiemo Kreuz 198c5dba77 Make button to add undocumented template parameter work
Thanks to the widget now being an actual ButtonElement.

Bug: T274544
Change-Id: I1b0ef28b0aa115a027a07f3ae53c583598483e96
2021-07-15 08:40:20 +00:00
Thiemo Kreuz eb1f1e28a3 Make new template editor sidebar items actual ButtonElements
Actually reusing this OOUI mixin gives us a lot of well
developed functionality we need anyway. Most notably proper
event management, e.g. click events.

The number of CSS properties we need to override is managable,
I would argue. Let's see:
* Our buttons are not inline-elements, but should use the full
  width.
* No focus-border left and right for the same reason.
* We want much more inner padding.
* We want a stronger hover effect.
* We need to fine-tune the position of the icon. This is
  because of the inner padding.
* Need to get rid of a negative margin that's only relevant
  for inline-buttons.

I currently feel like the benefits are worth living with
slightly more brittle code. Note that we can undo this change
any time because all this is well encapsulated in this new
class.

Bug: T274544
Change-Id: I33f275a958964d49e803e56bf74a6fa961093da1
2021-07-14 13:31:40 +02:00
Thiemo Kreuz 170ca9d58a Reuse generic button widget for elements in the new sidebar
This introduces another generic "button-like" class that can
be reused in multiple places in the new sidebar. The main
change in this patch is the "add more information" button
which is now an instance of this new class as well.

This patch also simplifies over-complicated setup code in
related widgets.

Bug: T274544
Change-Id: I0cfe7675d02fdd5c5dc8d9198bb3f4aec9abf397
2021-07-13 17:23:27 +00:00
Thiemo Kreuz 31904688df Update new sidebar when moving template parts up/down
The new sidebar now updates accordingly when elements are
moved around.

Bug: T274544
Change-Id: Ic6bc3484c54523aa4edc6b48a843c47059569061
2021-07-13 10:18:20 +02:00
Thiemo Kreuz 226e2657ef More robust debug container for new template editor sitebar
Before, the new sidebar was hacked in a place where it confused
the BookletLayout logic. This became visible when using the
up/down buttons to move elements in the sidebar.

This new container wraps the new and the old sidebar. It also
uses a temporary color to make it easier to see where one ends
and the other starts.

Bug: T274544
Change-Id: I4e5b40b1d1556886fc85cff9e926a02e4888f032
2021-07-13 09:11:57 +02:00