Commit graph

2913 commits

Author SHA1 Message Date
jenkins-bot 5c688148e8 Merge "Force delete button to be disabled on template parameters" 2021-09-15 09:30:32 +00:00
jenkins-bot 3b78f40e7a Merge "Optimize .selectPartById() to fire less events" 2021-09-15 09:07:18 +00:00
jenkins-bot 8ca4f2cc36 Merge "Change confusing property name in AddParameterPage" 2021-09-15 08:22:27 +00:00
jenkins-bot 345e1b6e09 Merge "Update AddParameterPage validation when the template changes" 2021-09-15 08:22:24 +00:00
jenkins-bot 478c95f77d Merge "Hide "required" indicator in new sidebar" 2021-09-15 07:44:58 +00:00
jenkins-bot 51eb60a81e Merge "Override default source mode font in placeholders too" 2021-09-14 21:21:47 +00:00
Thiemo Kreuz cb685d1216 Fix enter sometimes focusing the wrong template part
The behavior of the enter key in the new template dialog sidebar
is somewhat inconsistent. When pressing enter on the name of a
template it sometimes just doesn't work, but focuses something
else.

I realized this is because the message "The … template doesn't
yet exist." does not have a link. There is nothing to focus in
this element. The code just gives up and the selection returns
to whatever was selected before.

It works when there is a link in the template header. But this
is not even that useful.

Let's try to always focus the first parameter instead. The user
can still press Shift + Tab to focus the link to the template
page.

Bug: T289043
Change-Id: Id314ee8ebf47d387df08c7fb432094b6d8f7a3d2
2021-09-14 18:14:05 +02:00
Thiemo Kreuz 0f309f5b90 Hide "required" indicator in new sidebar
The previous patch I15aa2c0 (approved by UX) was incomplete. The
required indicator was still shown, depending on the skin.

This patch also reduces the amount of generated HTML when it
doesn't have an effect anyway. At the moment an empty <span></span>
is generated for _every_ parameter in the dialog. That's potentially
hundreds. But the element is only needed for deprecated and
(in the old UI) required parameters.

A missing space is added while we touch this code anyway. The
missing whitespace between label and indicator icon is confirmed to
be a bug by UX.

Styles that are the same on all skins are moved to the .css file
that's loaded for all skins. Missing word-wrapping for overly long
template parameter names (on the right side of the dialog) is added.
The position of the indicator icon was broken on Minerva the moment
a parameter name is a bit longer. Fixed by replacing `inline-block`
with `inline`.

Bug: T290492
Change-Id: Ie346d88969cec2effaf90d328d08567ab7b7bf75
2021-09-14 18:05:11 +02:00
Thiemo Kreuz 074a295a03 Change confusing property name in AddParameterPage
This kept confusing me. This is not an "input field", but a
layout container.

Change-Id: I77d8ddd4635c21512a5800f64e13e76fe08c3091
2021-09-14 17:15:55 +02:00
Thiemo Kreuz 51ad403117 Update AddParameterPage validation when the template changes
This applies in several situations. A trivial one is a parameter
that's already in use, but you uncheck it while the relevant
error message is shown. Vice versa.

Bug: T290977
Change-Id: Ia4114194a2efe34a7d51e633c776ce892cc9cb18
2021-09-14 17:13:02 +02:00
jenkins-bot 7bbdca3fb9 Merge "Avoid referencing methods via strings, take 2" 2021-09-14 14:09:35 +00:00
Thiemo Kreuz c33536112d Avoid referencing methods via strings, take 2
The first approach in patch I024ac1e doesn't work.

Change-Id: I4c9f8ef65c9e423a3e34f48483142a97ec6cef1e
2021-09-14 12:40:59 +00:00
Svantje Lilienthal 7f2821da78 Align more/less button
Bug: T290492
Change-Id: Iee160704d0875a1305ece5a4e075706e3ddb4957
2021-09-14 14:00:45 +02:00
jenkins-bot 787bc0db17 Merge "Revert "Avoid referencing methods via strings"" 2021-09-13 18:55:22 +00:00
Bartosz Dziewoński a667045383 Revert "Avoid referencing methods via strings"
This reverts commit 48283d5f19.

Change-Id: Ifc2b7fb9e9fb7deaecb6c0475db0f9253e81869f
2021-09-13 18:36:07 +00:00
Andrew Kostka a38338259d Improve input validation for the add parameter page
This patch improves the error handling for when a user tries to add
a parameter which is either an alias of a existing parameter, the
primary name of a existing aliased parameter, or a name/alias of an
existing parameter which is shown with an override label.

The error message was modified to always refer to the conflicting
parameter using the same name that is has in the sidebar.

Example: A parameter named "Parameter B" is already present in the
sidebar under its alias "B". When a user tries to add "Parameter B",
the new error message will inform the user that the parameter they
are trying to add already exists as "B".

Bug: T285869
Change-Id: I762b72b6cf14eb8ff5fcef63b4dcb70e297050de
2021-09-13 16:58:11 +02:00
Thiemo Kreuz 6680f5f141 Force delete button to be disabled on template parameters
It's impossible to use the delete button from the
OO.ui.OutlineControlsWidget to delete a parameter when the new
sidebar is active.

This partly fixes one of the issues mentioned in I97d77f4. The
delete button might stil become active for a moment (not fixed
yet), but doesn't stay active forever any more with this fix
in place.

Apparently this also makes another workaround obsolete.

Change-Id: I0bca310772c26149170af23ff8e5505c3ce4adf4
2021-09-13 16:01:25 +02:00
jenkins-bot a52cb05804 Merge "Avoid referencing methods via strings" 2021-09-13 13:28:19 +00:00
jenkins-bot 401319cb67 Merge "Split focus handling from add/remove parameter events" 2021-09-13 13:28:16 +00:00
jenkins-bot b4ac8c45ce Merge "Make "templateParameterClick" event similar to "choose"" 2021-09-13 13:24:37 +00:00
Thiemo Kreuz 48283d5f19 Avoid referencing methods via strings
Should be a bit more obvious, I hope.

Change-Id: I024ac1e2d68bfe4c5af733c48967af4c51f336c1
2021-09-13 14:26:16 +02:00
jenkins-bot 45659e2c60 Merge "Fix "add parameter" widget not being focused on click" 2021-09-13 12:25:50 +00:00
jenkins-bot 0cfd298d18 Merge "Fix and test page name splitting code in template dialog" 2021-09-13 12:23:17 +00:00
jenkins-bot 1e4ef48393 Merge "Use OOUI 'classes' property instead of .addClass()" 2021-09-13 11:46:19 +00:00
jenkins-bot bb22a6e4bb Merge "Add tests for ve.ui.MWParameterPage class" 2021-09-13 11:45:00 +00:00
Thiemo Kreuz e62b3fecbb Optimize .selectPartById() to fire less events
There is no point in firing this event when noting changed.
This should reduce flickering and some of the issues described
in I97d77f4.

Change-Id: I7c387889a4a33dac5053cec11a0641d358020b56
2021-09-13 13:42:20 +02:00
jenkins-bot 844606d573 Merge "Fix space bar on top-level template parts loosing focus" 2021-09-13 11:03:20 +00:00
jenkins-bot ebe31b5a5e Merge "Better colors when clicking/pressing elements in new sidebar" 2021-09-13 10:43:29 +00:00
Thiemo Kreuz e6f240c263 Better colors when clicking/pressing elements in new sidebar
This just copies the colors from the old sidebar.
* When hovering with the mouse (without click/press) the background
  is gray, and the text black. Relevant for readability via WCAG
  AAA.
* On click/press the background is blue (slightly darker than a
  selection), and the text is dark blue as well.

As noted in
https://docs.google.com/document/d/1V0rXMPr6upNjHF9AkROx4R8IF1LDZUzrG4K6oWT08sU

Change-Id: I443045b55826ef390688b32616dfdcfdc6555eb3
2021-09-13 11:07:22 +02:00
Thiemo Kreuz 6cb287c225 Fix space bar on top-level template parts loosing focus
As a reminder (not part of this patch): Pressing enter on the name of
a template should select it, and jump to the content area on the right.
Pressing space (that's what this patch is about) should select as well,
but not move the focus.

The best way to test the behavior is with a multi-part template.

Bug: T285323
Bug: T289043
Change-Id: I97d77f43b231696f92ba6758a6b8feac34e02e6d
2021-09-13 10:34:28 +02:00
Thiemo Kreuz aa556e3ef8 Update and fix all @param config and @cfg documentation
I tried to review all of them. Some of the changes I did:
* Make sure the `config` parameter is not marked as optional
  when it is not.
* Make sure default values are mentioned.
* List individual `@cfg` options when it makes sense.

Note I don't list all options a class could accept (e.g. via all
its parent classes and mixins). That's too much. Instead I checked
how a class is actually used and list only these options.

Even then I don't list everything, e.g. unspecific options
like "classes" that can be used pretty much everywhere.

Change-Id: Idf4fbe1dc3608ace277df9e385f2f140df3a2f50
2021-09-12 12:35:27 +00:00
Thiemo Kreuz 338a800837 Merge "templateParameterClick" and "choose" events
We don't need to distinguish between these any more. Both are
"active", i.e. both focus the widget on the right side of the
dialog. Sometimes the "choose" event is fired to actually add
or remove a parameter. Sometimes it's fired, but the state of
the parameter doesn't change (for whatever reason, i.e.
because the parameter name was clicked instead of the
checkbox). There is nothing to do in this case, except for the
focus change.

Change-Id: I3c7c0c81a075ccff76eda0a4fb2aa1ac7be3cec5
2021-09-11 17:47:08 +00:00
Thiemo Kreuz 1493aa7a35 Split focus handling from add/remove parameter events
* The template model fires an "add" event. Listeners don't
  automatically steal the focus any more.
* Instead there is a separate "focusTemplateParameterById" event
  fired from all relevant places that add a parameter.
* The "remove" doesn't steal the focus any more.

Bug: T285323
Change-Id: I93f17727524bfbcf6f11647a6c2441781337c4cc
2021-09-11 17:47:02 +00:00
Thiemo Kreuz cdc168d32a Use OOUI 'classes' property instead of .addClass()
The 'classes' property is a OOUI interface. Personally, I like
this code style better.

However. It appears like the code style in this codebase is
somewhat mixed. It looks like the top-level .$element always
uses .addClass(), while other code uses the 'classes' property.
Should we unify this?

Change-Id: I9ecd75e22d00f06ffd707f766dc9e8d748ff9a37
2021-09-11 17:41:45 +00:00
Thiemo Kreuz 22757fa901 Fix and test page name splitting code in template dialog
In JavaScript .split() behaves different, compared to PHP. In
PHP the last element contains the rest of the string. In
JavaScript the rest of the string is discarded. The limit acts
as if the array is truncated. That's why we can reduce the
number in

  'foo/bar'.split( '/', 1 )[ 0 ]

to 1, as we are only interested in the element "foo".

The same code in the other class is currently not covered by a
test. But changing it accordingly should be obviously fine now.

Change-Id: I20c27d480ddb1799df9eb1e5bc119b724e80653d
2021-09-11 17:40:39 +00:00
Thiemo Kreuz 3b59d7ce0d Add tests for ve.ui.MWParameterPage class
Change-Id: Ie09ef4745c006822cc66e845cb16f54d62fa3b7e
2021-09-11 17:39:17 +00:00
Thiemo Kreuz 7c872def9f Fix "add parameter" widget not being focused on click
When I try to click the input field, the expand/collapse button
is focused instead.

This also fixes a copy paste mistake in this class.

Change-Id: If9ab340711fbe7d88845c008360fde5df7059df0
2021-09-10 21:16:42 +02:00
Thiemo Kreuz 9b5438cba2 Hide content pane on narrow screens when sidebar is expanded
Before, the content pane (the right half of the dialog) was moved
to the right, outside of the visible viewport. But it was still
active and could i.e. be navigated to via the tab key. Only truly
hiding it solves this issue.

Bug: T274554
Change-Id: I8925a9cca0099528aca8e98452816b5f9dd23a76
2021-09-10 17:34:05 +02:00
Thiemo Kreuz ec526ea64f Make "templateParameterClick" event similar to "choose"
The original idea was to make the interface as narrow as
possible. However, it turns out it's better to model the
"templateParameterClick" event more closely after the "choose"
event.

This is split off to make reviewing the following patches
easier.

Change-Id: I271f576c6cd756cecfc6cb1fd64810f8da5c3575
2021-09-10 17:19:19 +02:00
jenkins-bot 9ef1b22b37 Merge "Clean up post- OOUI fix" 2021-09-10 14:37:12 +00:00
jenkins-bot 843aa24efd Merge "Don't allow users to add parameters that contain forbidden chars" 2021-09-10 10:14:53 +00:00
jenkins-bot 022db20850 Merge "Add input validation to the add parameter page" 2021-09-10 10:14:50 +00:00
jenkins-bot 2b7b96bbdc Merge "Remove invisible tab target from template dialog sidebar" 2021-09-10 10:00:17 +00:00
Adam Wight f8cf9e9b8e Clean up post- OOUI fix
Pure cleanup, doesn't change behavior.

Change If8da5ae85dff63c34 included in OOUI v0.42.0 tracks invisible
controls, so it's no longer necessary to maintain persistent class
variables pointing to the buttons.

Also simplify repeated logic to make it clearly exclusive.

Bug: T290554
Change-Id: If9b6404d7061999540515645fa8e50b9a21f5a21
2021-09-10 09:39:07 +00:00
jenkins-bot 38b0791ed8 Merge "Fix missing and flipped template dialog help messages" 2021-09-10 09:37:38 +00:00
Thiemo Kreuz 30d4096aeb Remove invisible tab target from template dialog sidebar
The list of parameters should remove itself from the list of
possible tab navigation targets when it's empty.

Note there is no way to remove elements from the parameter
list. That's why we don't care about "remove" or "clear"
actions.

Change-Id: I8b1215117e0ddc94f787d173e9bea6f7567d9671
2021-09-10 06:42:22 +00:00
Bartosz Dziewoński e04c9efe4e Override default source mode font in placeholders too
Depends on Ib54361bed9653ef5ba55099df4113b78794ffbdf in VE core.

Bug: T290176
Change-Id: Iea2712dc1a88f802e8b1a645ee74cc5db964e82a
2021-09-09 22:30:38 +02:00
Thiemo Kreuz 94a419e9a6 Fix missing and flipped template dialog help messages
Bug: T288465
Change-Id: I4aaa8d889084b770fa0cafab69a0b65128f3d82a
2021-09-09 16:11:00 +02:00
Andrew Kostka 97ef584e20 Rename showSidebar to expandSidebar for consistency
Bug: T274554
Change-Id: Ia0611fe10492e05e4625eb743c66eac7d0235dc5
2021-09-09 12:26:40 +02:00
Andrew Kostka 0c14b6d0bb Don't jump back-and-forth between fullscreen and floating when resizing
Previously, when the tranclusion dialog was being resized, there was
a specific width at which both the sidebar was collapsed and the dialog
was downsized from "larger/large" to "medium". This resulted in the
dialog switching from fullscreen to floating, since the dialog's width
breakpoint for "medium" doesn't match our width breakpoint for mobile.
If the user continued to downsize past this breakpoint, then the dialog
would eventually switch back to fullscreen resulting in this weird
behavior.

A simple way to prevent this is to avoid changing the dialog's size
at all. Since we don't support collapsing the new sidebar (unless
already in fullscreen), we can just leave the dialog at the
"larger/large" size.

Bug: T274554
Change-Id: I5460cdfb1a7ed73fe7957745ba37055c5f66dce1
2021-09-09 12:16:52 +02:00
Andrew Kostka 4c0666fd19 Don't allow users to add parameters that contain forbidden chars
Bug: T285869
Change-Id: I1011949c2724939f3cec1e1a2ae1c821c33eff84
2021-09-09 11:43:49 +02:00
Andrew Kostka 075ca72fe8 Add input validation to the add parameter page
Bug: T285869
Change-Id: Iebb982e95aa19bd61fcda915981d505cc243c4b2
2021-09-09 11:42:53 +02:00
Thiemo Kreuz 7edb3a82b8 Rename ambiguous onParameterInput event handler
This is split from patch Iebb982e to make it easier to review.

The name is rather ambiguous. Does "input" refer to the input
element? Is it triggered for every key press, i.e. when the
input changes? Or when it's submitted?

Change-Id: Iddbe3bfb9faf3561d8d71b96ffae507799827a95
2021-09-07 09:04:33 +02:00
jenkins-bot 0520bb6e34 Merge "Don't allow parameter names that break the wikitext syntax" 2021-09-06 08:39:07 +00:00
Thiemo Kreuz 3ee7a1f1ed Do not pass Message object to …DismissibleMessageWidget
I wanted to change this for quite a while now. It was discussed
again in Iff1d2c0.

Change-Id: Iaaac9bf91d9b11557ab068d2c719084c46b3ecb2
2021-09-03 15:21:36 +00:00
Thiemo Kreuz 1f4880181e Don't allow parameter names that break the wikitext syntax
Any of these characters results in bad wikitext, when we accept
it in a template parameter name.

Instead of displaying an error message we simply block the
button, as long as the input is not a valid parameter name.
Coming up with a message is not really worth it, I would
argue. Users typically don't have a reason to use any of these
characters. This is super rare. And even if, the behavior of
the widget is not hard to understand, I believe.

The same is done in ve.ui.MWParameterSearchWidget, a little
hidden in the .addResults() method.

Not yet approved by UX. Can be done in demo time.

Bug: T285869
Change-Id: I5576cdfb90411e5fdec93749f72939d31ecd9c56
2021-09-03 15:20:13 +02:00
jenkins-bot 6caf286134 Merge "Hide "required" indicator in new sidebar" 2021-09-03 11:08:17 +00:00
jenkins-bot e57bc90459 Merge "Fix doc padding in new sidebar" 2021-09-03 11:08:15 +00:00
Adam Wight 7fd96f9b38 Hide "required" indicator in new sidebar
This is redundant with other hints.

Change-Id: I15aa2c0249efdd2071af0c085c0a5de6a1d25b29
2021-09-03 11:48:26 +02:00
jenkins-bot 836ab09a79 Merge "Rename and document select/focus events in template dialog" 2021-09-03 09:38:21 +00:00
Adam Wight 7b0d4b1224 Fix doc padding in new sidebar
This was causing the doc text to be undesirably indented.

Change-Id: I3cf8fb1136d354ca04ee077c19e37998fdb85549
2021-09-03 11:37:18 +02:00
jenkins-bot 7eb5b5a1ef Merge "Cleanups and optimizations related to .parseDom()" 2021-09-02 20:03:09 +00:00
Thiemo Kreuz 36bd65dda7 Cleanups and optimizations related to .parseDom()
E.g. avoid calling the rather expensive method multiple times
in a row, if only 1 of the results is needed.

Change-Id: Iff1d2c0892367e927303f6f45d3231e04c045cab
2021-09-02 18:29:09 +00:00
jenkins-bot a7c584b6db Merge "Minor CSS cleanup related to gaps between booklet pages" 2021-09-02 14:19:57 +00:00
jenkins-bot d0653d8929 Merge "Tighten vertical gap between parameters" 2021-09-02 13:49:52 +00:00
Thiemo Kreuz e621df1cbe Minor CSS cleanup related to gaps between booklet pages
* Use a more specific …-top property, as this is the only thing
  we need to overwrite.
* Bring some selectors in a hierarchical order that makes more
  sense.

Change-Id: If36db87d83f699fe0a43ac67d439cac42cbb1fa3
2021-09-02 15:41:40 +02:00
jenkins-bot 5764fc6ac0 Merge "Make sure links in notices open in new tabs" 2021-09-02 13:22:31 +00:00
jenkins-bot 25da8cb9d7 Merge "Update template dialog help messages" 2021-09-02 13:20:31 +00:00
jenkins-bot 7848b1a071 Merge "Fix inconsistent keyboard :focus styles in template outline" 2021-09-02 13:04:17 +00:00
Adam Wight 7fca2417b8 Tighten vertical gap between parameters
Bug: T288465
Change-Id: I608f6e398ec77bf87bca363c761d44661ced8dfd
2021-09-02 14:33:53 +02:00
Adam Wight d8dcc89fa0 Update template dialog help messages
* New help text for the case where TemplateData is present, whether
  or not it includes a description.
* Remove help text when TemplateData is missing.

Bug: T288465
Change-Id: I0668ccae8eeb5ffffc626e3b7d24c1d7ed99bbed
2021-09-02 14:24:35 +02:00
WMDE-Fisch e8bb4b5010 Make sure links in notices open in new tabs
Bug: T276574
Change-Id: I458afab8a34d97619f858c49eea0cef3ad1b83fa
2021-09-02 14:12:01 +02:00
jenkins-bot 52fe00975e Merge "Add notes and warning for missing parameter documentation" 2021-09-02 11:49:59 +00:00
jenkins-bot 52ed6367f9 Merge "Mark link to non-existing template page red" 2021-09-02 10:25:54 +00:00
jenkins-bot 7c304dc444 Merge "Highlight first template parameter when using tab to navigate" 2021-09-02 10:18:22 +00:00
jenkins-bot abdbf57f84 Merge "Fix click/enter on template parameters not focusing the input" 2021-09-02 10:11:49 +00:00
jenkins-bot c8e00fb98a Merge "Highlight corresponding template parameter in new sidebar" 2021-09-02 10:10:13 +00:00
Thiemo Kreuz a395e76653 Mark link to non-existing template page red
Bug: T272487
Change-Id: I15b377feda3a4e3b4570986668dfaa066afd70e9
2021-09-02 10:02:57 +00:00
Thiemo Kreuz 06cf00f4c6 Rename and document select/focus events in template dialog
I tried hard to come up with the best possible names. Some of the
criteria I used:
* Longer and more unique is better. This makes it much easier to
  e.g. search for the event name.
* The term "part" should only be used for top-level parts. While
  template parameters have a unique id, they are not a subclass
  of …TransclusionPartModel and therefor not "parts".
* BookletLayout manages "pages" via "page names".
  * The page names of top-level parts are identical with the part
    id, see ve.ui.MWTemplateDialog.getPageFromPart.
  * The page names of parameters are identical with the parameter
    model id, see ve.ui.MWTemplateDialog.onAddParameter.

Some code knows parameter ids, but not what pages are. Other code
knows page names, but not what parameters are. The transition
currently happens in the …OutlineContainerWidget. We might want
to move this point up to the …TemplateDialog. But I would argue
this is good enough for now and can be changed later, if needed.

Bug: T285323
Change-Id: Iab2805b3203988db400b67c8d00e48905fdc53dc
2021-09-01 16:23:59 +00:00
WMDE-Fisch 1673f9f8bf Add notes and warning for missing parameter documentation
Bug: T276574
Change-Id: Iba0dd661ccdfd6cbb13aef7e8ace25995ecf0cf8
2021-09-01 17:29:25 +02:00
Thiemo Kreuz fc0b419540 Highlight first template parameter when using tab to navigate
I tried to memorize the cursor position in the list of
parameters. This way you could leave the list with tab, and
return to the original position with shift+tab. Unfortunately
this is not how the SelectWidget works. The moment the
highlight is gone it's gone. There is nothing that remembers
a position. We could introduce code to do this. But I feel
like this is a lot of effort for not much benefit. Also not
listed as a requirement anywhere, at the moment.

Bug: T285323
Change-Id: I8d44ba4539ec4b5535bc031accfeacd87e1886eb
2021-09-01 14:05:01 +00:00
Thiemo Kreuz 7a8ad64cbd Fix click/enter on template parameters not focusing the input
This got lost in patch I20dbd2b.

Both events come from the same sidebar class. The difference
between the two is:
* selectPart is when the button representing a top-level part
  is clicked.
* focusPart is when a parameter name is clicked while the
  parameter is already checked.

Yes, this is confusing at the moment. Following patches will
rename, merge and split a lot of these events to be much more
self-explaining.

Bug: T285323
Change-Id: I0c6b53c93c712ff5e47c1beb5199d590cba7ab1a
2021-09-01 16:01:17 +02:00
Thiemo Kreuz b7efea5559 Remove unused event listener from …ParameterSelectWidget
We forgot to remove this in I319896a. The individual
…TransclusionOutlineParameterWidgets don't fire this event any
more. Instead this is done by the …SelectWidget.

Bug: T285323
Change-Id: I2c29e45127464785ffdc32d73b52188fcbefb7bf
2021-09-01 11:58:36 +00:00
Thiemo Kreuz b0ddcb0010 Highlight corresponding template parameter in new sidebar
Note there are currently two different code paths utilizing two
different events. The existing event handler actually changes
the selection of the top-level part in the sidebar (the
corresponding template name turns blue). The new event handler
highlights a parameter (it turns gray). This is currently
intentional (partly because of a bug in OOUI). I will try to
merge these code paths, if possible.

Please test, and if it works fine from the user's perspective,
please merge it as it is for now.

Bug: T285323
Bug: T289043
Change-Id: I8fafee68b8b7ff225c7b3c327f483f3426d8129c
2021-09-01 11:15:37 +02:00
jenkins-bot f7265428e8 Merge "Try to use margin/padding instead of flex for template dialog" 2021-09-01 08:53:01 +00:00
jenkins-bot 3b5064318c Merge "Connect focus event from BookletLayout to new sidebar" 2021-09-01 08:47:07 +00:00
Thiemo Kreuz a4dac831d9 Try to use margin/padding instead of flex for template dialog
Proof of concept: while flex is – well – flexible, it feels like
this should be possible with some good old block containers and
margins. It's pixel-perfect in my test.

Bug: T288465
Change-Id: I1458900fff197e08ce318398524a3cf2b6b9ee2a
2021-09-01 10:35:52 +02:00
jenkins-bot fd4084efb9 Merge "Use ve.targetLinksToNewWindow in MWDismissibleMessageWidget" 2021-08-31 14:21:40 +00:00
jenkins-bot bc1af53609 Merge "Text improvements for unkown parameter input" 2021-08-31 14:10:46 +00:00
WMDE-Fisch 099d6bad87 Use ve.targetLinksToNewWindow in MWDismissibleMessageWidget
Change-Id: I71a2c933e4af0dac4a083ce34820fa2994fc388d
2021-08-31 15:06:20 +02:00
WMDE-Fisch 14d3e8144c Text improvements for unkown parameter input
- Change description text according to ticket
- Make sure link to template page opens in new tab
- Add missing placeholder text

Bug: T272487
Change-Id: Ie8189e9cb9db5908e8fc5fc8bf7ff20df5595094
2021-08-31 14:57:24 +02:00
jenkins-bot 9d0c480529 Merge "Narrow selector for links when adding _blank" 2021-08-31 12:42:36 +00:00
jenkins-bot a6c01e946a Merge "Rename …OutlineItem CSS class to match widget class name" 2021-08-31 11:35:18 +00:00
WMDE-Fisch 99cee2be11 Narrow selector for links when adding _blank
Change-Id: Ia05117759c81fff6f35256931d0894c0b8051fe6
2021-08-31 13:08:25 +02:00
jenkins-bot ef486588ce Merge "Add tests for new ve.ui.MWAddParameterPage" 2021-08-31 10:55:16 +00:00
Thiemo Kreuz c32a6d794a Fix inconsistent keyboard :focus styles in template outline
This fixes a few style issues:
* The buttons that represent top-level elements have a proper
  2px focus rectangle again. Back to the OOUI default.
* The list of parameters does have a 1px focus rectangle all
  around. Intentionally thin because there is a 2nd level of
  keyboard navigation (via cursor keys) in this element.
* All these focus rectangles look the same in Firefox. Before,
  it was a thin dotted line on the parameter list.
* Parameters with long names don't wrap on a 2nd line any more.
  I believe this was working before but got lost in I92e8fd2.

Bug: T285323
Change-Id: I0229b6395a64a9903335bf96349af70fb20ad047
2021-08-31 12:30:24 +02:00
Thiemo Kreuz b84251080a Rename …OutlineItem CSS class to match widget class name
Bug: T285323
Change-Id: Ib307a23adb4712f253610b5029483ea8c049b7ce
2021-08-31 12:16:10 +02:00
jenkins-bot 7f8b6202ac Merge "Correct focus handling when adding undocumented parameters" 2021-08-30 15:43:35 +00:00
Thiemo Kreuz fcd555ba68 Correct focus handling when adding undocumented parameters
When I press the button to expand the input field for
undocumented parameters, it needs to be focused. Otherwise I
have to click it manually all the time.

We probably forgot to list this as an acceptance criteria when
working on Ic5dcd36.

This also replaced a bit of JavaScript with CSS. I do this
mainly because I found the mixture before (one piece was
hidden via JavaScript, another via CSS) a bit confusing.

Bug: T272487
Change-Id: I0cbee63c65a37f2f1860bde007c1e5c8408ba006
2021-08-30 17:03:30 +02:00
Thiemo Kreuz 99558f9076 Connect focus event from BookletLayout to new sidebar
This makes sure the corresponding top-leve part is selected in
the list on the left when navigating the main area on the
right.

Bug: T289043
Change-Id: Id1b398e1786c4099d5b14fe88dd21a106269096b
2021-08-30 17:00:52 +02:00
Thiemo Kreuz e9bd350f68 Add tests for new ve.ui.MWAddParameterPage
The class was added via Ic5dcd36 just a few days ago.

Bug: T289560
Change-Id: I3f729fb6c5d7c28a221d88294d5547809f10a17d
2021-08-30 13:02:52 +00:00
Thiemo Kreuz 0ba7480901 More complete top-level part selection support in new sidebar
This comes with a few significant changes:
* A whole bunch of places in the code that focus and highlight
  an element in the old sidebar consider the new sidebar now.
* Same when e.g. the toolbar at the bottom needs to know which
  part is selected. This is read from the new sidebar now.
* To make this possible I had to merge the small helper class
  we introduced in I7bc73cc back into the dialog.

It's helpful to understand how the event flow works:
* You click a template name. This does nothing (does not select
  the element). It only triggers an event.
* The event is catched by the outer container that manages
  all parts. From there all elements are unselected, and one
  selected. This call is internal and should not trigger
  another event.

Bug: T285323
Bug: T288827
Bug: T289043
Change-Id: I4a2d2b83cf2691423d4b0e6f4487228fa3c7b56d
2021-08-27 19:16:00 +02:00
Thiemo Kreuz 544bd5688c Allow selecting top-level parts in the new sidebar
This is mostly, if not exclusively visual, at the moment. The
actual state is still managed by the old sidebar.

I made the element OptionWidgets for convenience. This gives us
all the functionality we need (primarily setSelected and
isSelected), without to much clutter. However, I didn't made
the container a SelectWidget. This comes with to much stuff we
don't need at this level, e.g. cursor key navigation.

Bug: T285323
Bug: T289043
Change-Id: I20dbd2ba23ceaa9125947b25e037c0bb3c91a471
2021-08-27 18:22:37 +02:00
jenkins-bot c1ce1e3d4b Merge "Move small code snippets into …OutlineParameterSelectWidget" 2021-08-27 11:36:53 +00:00
jenkins-bot c5ea00c03d Merge "Remove wikitext buttons from the content view" 2021-08-27 10:33:02 +00:00
jenkins-bot 86f9acf616 Merge "Cleanup feature flags in ve.ui.MWParameterPage" 2021-08-27 10:32:10 +00:00
jenkins-bot f2b94e10b6 Merge "More test cases for MWTransclusionOutlineContainerWidget" 2021-08-27 10:00:04 +00:00
Andrew Kostka d94fb21b1e Remove wikitext buttons from the content view
Bug: T285669
Change-Id: I875a41e54e7a33cb9f67383d887a732a31649bbb
2021-08-26 17:47:14 +02:00
Thiemo Kreuz 7aeff4bfd3 Move small code snippets into …OutlineParameterSelectWidget
Most notably:
* Move some code snippets from the outer …TemplateWidget to
  the inner …SelectWidget, without introducing new
  dependencies.
* Move all knowledge about the item class
  …OutlineParameterWidget class into …SelectWidget.
* Some more self-documenting method names for event handlers.
* Avoid the somewhat ambiguous variable name "checkbox" in
  favor of "item". That's how it's named in the upstream OOUI
  …SelectWidget.

This is extracted from the following patch Ibd94c39. The
difference is that the following patch adds a new dependency:
The …SelectWidget gets to know the template model. This patch
here contains all changes that are possible without this new
dependency.

Bug: T288827
Change-Id: I187f313c84424b28005d9276cb1356029f9ebb75
2021-08-26 17:30:03 +02:00
Andrew Kostka afe8e8f721 Cleanup feature flags in ve.ui.MWParameterPage
Change-Id: Id1be6512f763d9ddb98665005d378947fdd3e6bb
2021-08-26 17:25:09 +02:00
jenkins-bot a5718f01c5 Merge "Remove unnecessary title parsing from template related code" 2021-08-26 15:08:13 +00:00
jenkins-bot 765b1da5b1 Merge "Use spec label for template link generation" 2021-08-26 14:13:22 +00:00
Thiemo Kreuz c8536f1a71 Remove unnecessary title parsing from template related code
There are 2 situations:

1. Either the template name is used in a [[…]] link. In this case
we must provide the namespace. MWTemplateModel.getTitle() does
this. However, it's not a mw.Title object and therefor not really
guaranteed to be a valid title. This is fine. The worst thing
that can happen is that the link points to an error message.
But this should be entirely unreachable anyway.

2. Some messages want to display the name of the template.
Ideally without the namespace. That's what
MWTemplateSpecModel.getLabel() is for. Again this is not
guaranteed to be a valid mw.Title. But it doesn't need to. It's
only used as a label.

Change-Id: I03d0481201620a2f5c444ee32b656bcaade98aac
2021-08-26 15:58:15 +02:00
jenkins-bot 34992ba3ac Merge "Basic cursor key support in new template dialog sidebar" 2021-08-26 13:46:40 +00:00
WMDE-Fisch 3913f635d4 Use spec label for template link generation
We should only need that label for the link. The other mechanic
would fail when editing wikitext like this:

{{{{echo|<}}|param=foo}}

Bug: T272487
Change-Id: If8d228b40bf1589181e83e8f68f3c33b4c7759c7
2021-08-26 15:09:48 +02:00
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 6c33cc4a35 Merge "Add message on multipart content" 2021-08-26 07:34:15 +00:00
jenkins-bot 5be007ee9a Merge "Minor cleanups to new add parameter input widget" 2021-08-26 07:26:53 +00:00
jenkins-bot 4741abe803 Merge "Added new input page for undocumented parameters" 2021-08-26 07:26:41 +00:00
WMDE-Fisch 67988452ab Add message on multipart content
Bug: T276574
Change-Id: Iff5c2fd4071dd03ca62c395cce4041dacb1c7ea6
2021-08-25 10:47:16 +02:00
Thiemo Kreuz 9392282bf2 More test cases for MWTransclusionOutlineContainerWidget
This also fixes a mistake in the class where we forgot to
disconnect event handlers when an element is removed from
the list. This doesn't have much of a consequence, as the
event flow is only in one direction, from the destroyed
element up. This is not possible any more.

Bug: T289560
Change-Id: I0bcc1d68c50b8cbdb033ef6692b34e2fc94e8d85
2021-08-24 15:46:46 +00:00
Thiemo Kreuz 3bca0f30c9 Minor cleanups to new add parameter input widget
Most of what I did in patchset 1 is now squashed into the
original patch Ic5dcd36.

Bug: T272487
Change-Id: I5cfd500da4c496a31ec5a28fedee4a079acc6123
2021-08-24 10:22:55 +02:00
Svantje Lilienthal 5c9fbca085 Added new input page for undocumented parameters
Bug: T272487
Change-Id: Ic5dcd36c9f647f9b52b98e5a520a1df1960a5b48
2021-08-24 10:18:43 +02:00
jenkins-bot e803c20007 Merge "Rename …ParameterCheckboxLayout now that it's an actual Widget" 2021-08-23 14:46:09 +00:00
jenkins-bot f1c9012916 Merge "Remove dependency from new sidebar to the BookletLayout" 2021-08-23 14:40:02 +00:00
jenkins-bot 6cdd1f6ebf Merge "Clean up toggleSidebar by splitting out 'auto'" 2021-08-23 14:31:39 +00:00
Thiemo Kreuz 3b5bc1b0b2 Fix non-existing property name .isNewSidebar
This is obviously a rebase mistake. We renamed the property in
I78a5129.

Change-Id: I43247ebf6c8910d12c90aa2dd1f9111f4ed69a07
2021-08-23 15:44:28 +02:00
Adam Wight b1a376a6e1 Clean up toggleSidebar by splitting out 'auto'
This naturally fits into a new function.

Bug: T274554
Change-Id: Icda432dc1a13243efddc9949f41a00162053970d
2021-08-23 14:38:24 +02:00
jenkins-bot d6316145b5 Merge "Better method names in MWTransclusionModel class" 2021-08-20 11:29:49 +00:00
jenkins-bot 112bd2e5cb Merge "Call focusPart() only once in MWTemplateDialog.onReplacePart()" 2021-08-20 09:56:52 +00:00
jenkins-bot cdf7d907a9 Merge "Fix null error in ve.ui.MWTemplateDialog" 2021-08-20 09:48:27 +00:00
jenkins-bot 928b33ce69 Merge "Re-add adding undocumented paramters in some cases" 2021-08-20 09:33:18 +00:00
Thiemo Kreuz 8fbdd4258f Fix null error in ve.ui.MWTemplateDialog
Introduced via Ifd52369 just a few minutes ago.

Bug: T288827
Change-Id: I859f606c0608f9725bb64ff56a501a7a2c85c1df
2021-08-20 09:24:56 +00:00
jenkins-bot 6f052b928d Merge "Use page ID string instead of object reference" 2021-08-20 08:37:48 +00:00
jenkins-bot d3e8fe001c Merge "Streamline and harden template paramter search widget behavior" 2021-08-20 08:35:45 +00:00
WMDE-Fisch c3e5ea2fe1 Re-add adding undocumented paramters in some cases
Bug: T272487
Change-Id: I862c2802da1340d302a2a95e8e9d17bd6fd35877
2021-08-20 10:13:20 +02: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 7045371a4d Better method names in MWTransclusionModel class
Names like "fetch" or "resolve" are heavily ambiguous and
continue to confuse me. I hope these new names reflect better
what's going on.

Bug: T288827
Depends-On: I587a203a9370e4742f87586b4f1867b37459c375
Change-Id: I8fa47ed313e7d7b2c114a5638a67c4f3c8b830f1
2021-08-20 10:00:10 +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
Thiemo Kreuz 301c84bda4 Call focusPart() only once in MWTemplateDialog.onReplacePart()
This merges all code-paths that re-select a part (i.e. an input
widget on the right side of the template dialog).

Note there is an edge-case that actually changes with this
patch. When a page is removed, and creating a new page fails,
there is an `if ( page )` check. Before, the behavior was that
nothing gets selected in this case. After this change the
behavior is the same as if a page was removed: the closest one
gets selected. Not only does this make more sense. The `if` is
only a fail-safe anyway and should not result in different
behavior.

Bug: T288827
Change-Id: Ibb0260587588fb51a876658b16a81c5a73371dc4
2021-08-20 09:49:30 +02:00
Thiemo Kreuz 47bed4e1c8 Use page ID string instead of object reference
You will see where I'm going with this in the following patches.

Bug: T288827
Change-Id: Ifd52369d19c01499fb9cc801c3deec46c26810fd
2021-08-20 09:47:57 +02:00
Thiemo Kreuz 45096d1e2f Streamline and harden template paramter search widget behavior
What this changes:
* The moment the user selects anything in the parameter search
  widget, the input is cleared, no matter what happens next.
  Even in case of an error. We know the input was bad in this
  case. Let's get rid of it.
* The method makes sure it does not even try to add a
  duplicate parameter. This should be unreachable, but better
  be safe than sorry.

This is split from I5eeb973. I run into this while playing
around with different approaches related to hiding deprecated
parameters. Typically there should be no way the parameter
search widget offers a duplicate. Still I believe it's a good
idea to have this extra safety-net.

Bug: T272487
Bug: T288827
Change-Id: I04e76d73b4a3f6467d0ccf3ccff5d2f6b4114bd9
2021-08-20 07:46:26 +00: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
jenkins-bot fdde92f820 Merge "Refactor onReplacePart in TemplateDialog" 2021-08-19 13:40:52 +00:00
jenkins-bot 0bf5c8493b Merge "Remove parameter adding on new sidebar code" 2021-08-19 13:40:16 +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