Commit graph

8335 commits

Author SHA1 Message Date
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
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 b7f572bd06 Merge "Reduce deep nesting in ve.dm.MWTransclusionModel" 2021-08-19 13:40:55 +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
WMDE-Fisch eeda931f59 Refactor onReplacePart in TemplateDialog
As preparation to introduce then new UI to add unknown parameters.
This is a few things:
- Merge the code paths when adding a MWTemplateModel
- Put code adding parameters to the dialog next to each other so
  that preventing reselection happens around that block
- Reduce duplicated code when re-focusing after addition
- Move adding the placeholder page to the end
- Add and clean up inline documentation

Bug: T272487
Change-Id: Ic700edd42027a928a236ed11f2c257fffe994257
2021-08-19 08:19:01 +00:00
WMDE-Fisch d41714f3a1 Remove parameter adding on new sidebar code
This removes the paramter placeholder page from all places where it's
not usefull anymore under the new sidebar.

The new UI will be re-added in follow up patches.

Bug: T272487
Change-Id: Ifc6f6f64fed1a1b23c92282e2a1bb40a7d401d72
2021-08-19 08:18:55 +00:00
Thiemo Kreuz 0af0978db4 Use same .useNewSidebar property name everywhere
This makes it easier to find stuff.

Change-Id: I78a51290767db4fe06ba0d4d2d251e8df07368b4
2021-08-19 10:13:16 +02:00
jenkins-bot ef43ae2950 Merge "Add getters for un-/documented parameters" 2021-08-19 07:19:05 +00:00
WMDE-Fisch 9aaeac3318 Add getters for un-/documented parameters
Will be needed to figure out when the new UI to add parameters should
be visible.

Bug: T272487
Change-Id: I97d2429b7845905784ef18e9d41cd5e6f85bbd01
2021-08-19 07:00:30 +00:00
jenkins-bot 5102ed2ab5 Merge "ve.ui.MWMediaDialog: mediaUploadBooklet may be undefined" 2021-08-18 16:50:07 +00:00
jenkins-bot f2e0388dc1 Merge "ve.ui.MWBackTool: Avoid using global ve.init.target" 2021-08-18 16:50:04 +00:00
jenkins-bot 68cfd5da16 Merge "Remove addParameter button from new sidebar" 2021-08-18 09:34:26 +00:00
jenkins-bot b05b165981 Merge "Make template parameter checkbox widget an OptionWidget" 2021-08-18 09:31:52 +00:00
jenkins-bot 029a982625 Merge "Remove unwanted scrollbar in responsive template dialog" 2021-08-18 09:22:36 +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
jenkins-bot 52e24c650a Merge "Remove sidebar margin on single transclusion" 2021-08-17 13:29:16 +00:00
WMDE-Fisch 03af517d19 Adjust icon spacing in new sidebar menu
The icons have a padding of 6px around the icon image itself. To
get to the required 16px/8px space the margin was adjusted
accordingly. Note that there's also a 2px padding around the menu.

Bug: T272482
Change-Id: I3df9f355dfd5c4e6366432555b96bf788e784280
2021-08-17 14:26:06 +02:00
WMDE-Fisch 53186fc231 Remove sidebar margin on single transclusion
Bug: T272482
Change-Id: I5696dbd469161b1ab1ede2bb3f49e6dd24b98521
2021-08-17 13:54:36 +02: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 4d6d700e8f Merge "Add isDocumented() feature to ve.dm.MWTemplateSpecModel" 2021-08-16 11:29:26 +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
jenkins-bot 0e6c56160e Merge "Show sidebar controls only when multi-part content is present" 2021-08-16 10:54:41 +00:00
jwbth 6d7a062dbb Fix history.replaceState call on diff pages
The history.replaceState call in onReviewModeButtonSelectSelect() (1)
ignores any changes to the document URL made by external tools such as
RevisionSlider, (2) replaces with an empty string the history entry
state object if it was set by external tools such as, again,
RevisionSlider. Both 1 and 2 result in a wrong URL ending up in the
address bar at some point. This patch addresses these problems, (1)
creating a new mw.Uri() object every time
onReviewModeButtonSelectSelect() is called, (2) keeping the current
history.state object.

The original variable storing the URI object is renamed to avoid
shadowing (optionally can be replaced with its value as it's used only
once).

Bug: T288636
Change-Id: Ieb97b561a6c076aa28aae231fe286ac4d1051bbd
2021-08-14 10:51:24 +00:00
Thiemo Kreuz b264a9c381 Add isDocumented() feature to ve.dm.MWTemplateSpecModel
Bug: T272487
Change-Id: I39c612358cc0238c515c8eb28aa1b40418a10cef
2021-08-13 12:47:28 +02:00
jenkins-bot 3999f5bac3 Merge "Fixing minor jsdoc typo" 2021-08-12 09:30:17 +00:00
jenkins-bot ea0f1c2610 Merge "Minimize template dialog CSS a bit" 2021-08-11 13:19:20 +00: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 1f91b2e185 Merge "Rename and document definition of "empty" in ve.ui.MWParameterPage" 2021-08-11 07:44:33 +00:00
Thiemo Kreuz 97486b2b3d Rename and document definition of "empty" in ve.ui.MWParameterPage
I found this while working on T274551, which is all about the
definition of "empty".

In the old sidebar a parameter's name is dimmed (gray) as long as
the parameter's value is empty. This stops working entirely when
there is a default value.

My first impulse was "this is a bug". When there is a default
value, both the empty string and the default value (when the user
enters it exactly) typically trigger the same behavior: The
template uses the default value, just as if the user entered it.

But this code is correct because of the way it is used. Only
parameters that are "truly" empty should be visually marked as
such. The moment there is a default value it is either impossible
to change this back to an empty string – meaning the parameter
can never be truly empty – or the empty string is meaningful user
input.

Bug: T274551
Change-Id: I90657bfe83e56afd3942428c0dd8a47b444e39c9
2021-08-11 07:24:41 +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 993c64f9a2 Minimize template dialog CSS a bit
Bug: T272481
Change-Id: I156c8f2ea4a70d2e86a7bc4282738c51bebc3f2a
2021-08-11 08:09:40 +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
WMDE-Fisch 8f39c56ded Fixing minor jsdoc typo
Change-Id: Id543c939836d1c15f5cfdcfc7450efc574e85cb6
2021-08-10 16:15:30 +02:00