Commit graph

805 commits

Author SHA1 Message Date
jenkins-bot 70ddd1f3f7 Merge "[Clean up] Remove unnecessary container and CSS in sticky header" 2023-01-13 20:57:24 +00:00
bwang 787b065f99 [Clean up] Remove unnecessary container and CSS in sticky header
Change-Id: I7a1f75e8997ea6c87955f72c971f6d1d08e6ab22
2023-01-13 20:11:21 +00:00
jenkins-bot 21996f5bc5 Merge "Table of contents elements should not be rendered where none available" 2023-01-13 18:15:31 +00:00
Func a874eb1096 LanguageDropdown: Check if the page is in talk namespaces instead
$wgContentNamespaces is default to only contain the main namespace,
we should check whether the page is a talk page instead.

Also use the term "subject page" to align with existing functions
of Title and NamespaceInfo.

Bug: T316559
Bug: T326788
Change-Id: I873283195d5c503818b2056c87c25ecc77d2915a
2023-01-13 14:44:49 +08:00
Jon Robson 853ed72cd6 Table of contents elements should not be rendered where none available
Follow up to  0c0ce631ee

Bug: T319355
Change-Id: I6b01a7dfef8f2cd124e090e25f63bd41579d9c08
2023-01-12 22:47:15 +00:00
Jon Robson 67cde518cd Use correct ID for table of contents in sticky header
Follow up to  0c0ce631ee

Bug: T319355
Change-Id: I525160e8041ba74c9aed94dd667a4aad53918032
2023-01-12 20:40:48 +00:00
Jon Robson 7f0b5fe305 Dead code elimination: updateDropdownMenuData
* updateDropdownMenuData is removed. Although it was running
inside legacy Vector, it didn't do anything as legacy Vector has
no concept of collapsible items or icons.
* updateLinkData is no longer used.

Also:
Document where other methods are being used.

Bug: T320927
Change-Id: I5b40075db91b1d0f20c21bd7cf858fdfcff96538
2023-01-12 00:33:28 +00:00
Jon Robson eea5373940 Components: StickyHeader
complete the migration to components.

Changes:
* shouldHideLanguages only used inside SkinVector22 so abstract method
and legacy implementation removed.
* Move isLanguagesInContent method to SkinVector22, updating one usage
in SkinVectorLegacy which is always falsey (languages are always portals
in legacy Vector)
* Remove unused isLanguagesInContentAt method from SkinVectorLegacy
and move getLanguagesCached, isULSExtensionEnabled,
canHaveLanguages, isLanguagesInContentAt to SkinVector22
* runOnSkinTemplateNavigationHooks copied to both Vector skins
* isResponsive moved to Vector22. In Legacy Vector it has no
real use since legacy Vector has no responsive styles.
* SkinVector class now (empty), is removed.

Bug: T319355
Change-Id: Ib5df956cecb841b7c97264975d137af32e5da4ab
2023-01-12 00:32:35 +00:00
Jon Robson 0c0ce631ee Components: Model table of contents in title bar.
Bug: T320927
Change-Id: Icd871e1bdf4ab0c7aa5b906b913416f4b1747750
2023-01-11 15:42:23 -08:00
Jon Robson bfeb729f84 Component: VariantsMenu
Bug: T319355
Change-Id: I10a8e796f6f6744fcc79ff6b1eb8f1d42389acba
2023-01-11 23:05:41 +00:00
Jon Robson e153561255 Component: UserLinks
Simplify the user links component
Introduce MenuListItem and IconLink components.

HTML changes:
* Logout, login and account links are now wrapped in a ul and li tag
instead of a DIV for consistent with other menus (this occurs due
to use of MenuContents). Code reviewer can see tests
for an understanding of how the template data and markup has changed.

VISUAL CHANGE:
* Increased margins in user links menu relating to change from DIV to
UL / LI tags.

Bug: T320927
Change-Id: Ia24be48105e1ff85da227883abb5dddb3d54388d
2023-01-11 21:48:11 +00:00
jenkins-bot d0458b885a Merge "Remove vector-menu-dropdown-noicon class" 2023-01-11 01:12:11 +00:00
Jon Robson e032d68703 Remove vector-menu-dropdown-noicon class
No longer needed.

Change-Id: I3a0e7f7f2a467fc55b138fc3a9d06096c84a8f8e
2023-01-10 23:48:05 +00:00
Jon Robson 5508712d33 Refactor: Remove unnecessary function getULSButtonData
Change-Id: I85aaf6087a04376ed0191395413d0ef1ba575a27
2023-01-09 22:52:17 +00:00
jenkins-bot 09ede0dc9f Merge "Update language dropdown for pages not supported in other languages" 2023-01-09 05:02:55 +00:00
NikG d39b5c958a Update language dropdown for pages not supported in other languages
Pages that are not supported in other languages should not display the
ULS when the language button is clicked. Instead, a simple message
explaining that the page contents are supported in other languages
should be displayed inside the dropdown. Additionally, the language
button should be modified for these non-content pages, to non include
any label and be quiet instead of progressive.

This patch implements these specifications by appropriately modifying
the mustache templates and the underlying skin classes.

Bug: T316559
Change-Id: I37d8e61a1287b31d1a304d2a955f532b9b8fa505
2023-01-06 16:40:36 +00:00
jenkins-bot bd2f9b6ca6 Merge "Log events for pinnable header button" 2023-01-06 15:53:54 +00:00
Jon Robson a43d522331 Fix language button fallback
* Don't hide language button
This code can be removed now  T287206 is resolved.
Also simplify legacy logic - as the language menu
is always a portlet there.

Additional changes:
* Create LanguageButtonDropdown component to distinguish
this code from the LanguageButton in the sticky header.
* Fixes a style in LanguageButtonDropdown.less which wasn't
accounting for multiple vector-menu-content classes

Bug: T320927
Bug: T325017
Change-Id: Ic331684c384c5d57b60b098f23485e44fb75fb8f
2023-01-06 00:45:31 +00:00
Jon Robson 8d6ef47699 Refactor SkinVector22::getTemplateData and add test coverage
Bug: T318434
Change-Id: If06e6618adaae614ea7fe9b803b1f4fd80170d59
2023-01-05 22:46:05 +00:00
jenkins-bot 8764c03892 Merge "Test ServiceWiring.php" 2023-01-05 22:12:31 +00:00
Jon Robson b27e4d0656 Log events for pinnable header button
Bug: T324878
Change-Id: I3174fc7f90b106c32ae4eb1fb42d089e01967220
2023-01-05 12:15:03 -08:00
jenkins-bot 87794f6b0d Merge "Replace .sidebar-toc class with .vector-toc and use PinnableElement in TOC" 2023-01-05 00:35:57 +00:00
bwang 8e4da83908 Replace .sidebar-toc class with .vector-toc and use PinnableElement in TOC
Using PinnableElement in the TOC allows us to reuse styles associated with all PinnableElements, and helps ensure consistency between page tools and the TOC. This is something that would probably need to be done for T324505 anyway
Rather than updating PinnableElement to accept a class prop, I chose to rename '.sidebar-toc' to '.vector-toc', making the TOC's naming conventions consistent with the rest of Vector.
"sidebar" doesn't make sense anymore anyway, as the TOC can be in multiple locations and it's best to avoid the "sidebar" term

Bug: T324877
Change-Id: I5b9228380f5c4674ef424d33127a5cb4010822da
2023-01-04 17:48:03 -06:00
jenkins-bot 18ff4cdced Merge "Update dropdown and pinnable element styles to match spec" 2023-01-04 20:34:02 +00:00
bwang fe105edcdb Update dropdown and pinnable element styles to match spec
- Generalize spacing for pinnable header and menu items under PinnableHeader.less and PinnableElement.less
- Impacts main menu, page tools & personal tools

Bug: T324877
Change-Id: I4042e5c1957d64797f21146f687ef960721299ce
2023-01-04 11:24:55 -05:00
Jon Robson 3dbadabdfe Document the importance of vector-menu class
It's used by click tracking so marking with inline comment that
we need to be careful if we plan to remove it in our current
refactoring.

Change-Id: I6aee01363d2d150844e61fb27ab584c8ee78c4ae
2023-01-03 14:45:40 -08:00
Dreamy Jazz 9d265af32f Test ServiceWiring.php
Test ServiceWiring.php using tests copied from CentralAuth. Because
phpunit does not support marking a file as covered, the file is
marked as ignored for code coverage. However, these tests do not
fully cover the single service as these tests only verify that the
call to the service does not result in an error.

Change-Id: I6100d242aa61975cab7c44b35616cb2b19762cbf
2022-12-24 01:07:25 +00:00
bwang 7f2118e756 Update header spacing to match spec
Bug: T324877
Change-Id: I47be192f5ba726904dc225afd54ee9112e97dc10
2022-12-20 17:58:54 -06:00
bwang a348db9969 Add generic classes to pinnable container
Bug: T324877
Change-Id: Iab94f9f600f8e6d032ad70d6b8e502686977441c
2022-12-20 17:22:11 -06:00
bwang 6c817e932f Use features.js for main menu pinning functionality
- Register new feature for main menu pinned
- Update UserPreferenceRequirement to optionally handle default config values
- Add nav landmarks for the main menu

Bug: T317900
Change-Id: I8fc6e0a79a1155d68afb9e33e5101a2a160dc4e5
2022-12-16 12:56:54 -06:00
bwang 46f17487fd Update main menu templates and classes to be consistent with other pinnable elements
- Rename data-portlets-main-menu to data-main-menu
- Rename MainMenuContents.mustache to MainMenu
- Replace usage of .vector-main-menu-contents in favor of .vector-main-menu
- Add classes to PinnableContainer
- Use PinnableContainer and PinnableElement in main menu
- Remove MainMenuDropdown.less

Bug: T317900
Change-Id: I59b3acd3d56cd5761e5978607634dfb9a88f60e3
2022-12-16 17:34:23 +00:00
jenkins-bot 5c7a3d46fd Merge "Remove extraneous $isRegistered variable and VectorServices::getFeatureManager call" 2022-12-16 00:19:00 +00:00
Nicholas Ray c152db2cbe Remove extraneous $isRegistered variable and VectorServices::getFeatureManager call
Some follow-up cleanup from 867701

Change-Id: I93d50c15b572b78a4861a8e4347d706fd2e4c04d
2022-12-15 15:56:53 -07:00
bwang 9abdaf54c3 Remove -pinnable-element postfix from PinnableElement.mustache
This allows '.vector-main-menu' to correspond to MainMenu.mustache, and 'vector-page-tools' with PageTools.mustache

Bug: T317900
Change-Id: I65c0d7cffbdf1cf9e59cde0c0fc4dca788e799de
2022-12-15 22:46:51 +00:00
bwang 3ad3d70745 Rename VectorComponentPinnedContainer to VectorComponentPinnableContainer to match template files
Bug: T317900
Change-Id: I557fbef46fd1ea5984ded7f1a067cc43656e7076
2022-12-15 22:46:46 +00:00
jenkins-bot 9463861054 Merge "Refactor page tools, main menu, and TOC components" 2022-12-15 22:44:05 +00:00
jenkins-bot ebdea1b0df Merge "Clean up cached .vector-menu-portal code" 2022-12-15 22:30:30 +00:00
bwang 97de09dcba Refactor page tools, main menu, and TOC components
- getTocData is moved into VectorComponentTableOfContents and it's test file
The following changes were made to the main menu, toc and page tools PHP components
- Avoid passing in $skin to the constructor
- Handle isPinned logic inside the component
- Add a public ID constant to the components
- Dropdown data for each feature use the same naming convention

Bug: T317900
Change-Id: I77a617a6c1d93bccd3b6e59353299f5534624e53
2022-12-15 14:23:25 -08:00
bwang f006e00677 Clean up cached .vector-menu-portal code
Follow up to I884cd33938b2670bddc90f698d8f61f37c6c29d4

Change-Id: Icd329aa4a43aa738b0127f7147b5401e07d90c05
2022-12-15 14:30:58 -06:00
Nicholas Ray a25dba2a19 Move toolbox and menus that follow into page tools
Uses all of the changes from Jon's patch in 866503 to move all of the sidebar
menus after and including the tools menu into the page tools component. The rest
of the menus remain in the main menu.

Additionally:

* Per T317898#8468437, the "Tools" label should be "General". It was also
assumed from the prototype that the "More" label should become "Actions"

Bug: T317898
Change-Id: Ic9c1586febd8ebfff4a17285e6bd59cee509bd34
2022-12-14 13:38:13 -07:00
Jon Robson 85d75f1e7c Don't add empty table of contents to page
Follow up to I0a740f8543831e266f2b1b874b40e44c8241d4cb

Bug: T317900
Change-Id: I1b63b5bd8e0f9f31fc7acd01665bf92061a45fd8
2022-12-13 14:01:34 -08:00
Jon Robson 77aa8e0cbd Components: MainMenu and Pagetools use VectorComponentMenu
Bug: T317900
Change-Id: Ic91a638a3d90f5533dc624870bbefbff2950767d
2022-12-12 22:17:29 +00:00
Jon Robson c10ef66e6e Refactor: PageTools composes several different components
* Introduce Dropdownmenu, PinnableElement and PinnedContainer components

Additional changes:
* Drops unused has-multiple-menus
* Update TableOfContents to use PinnedContainer and PinnableElement

Bug: T317900
Change-Id: I0a740f8543831e266f2b1b874b40e44c8241d4cb
2022-12-12 22:17:24 +00:00
Jon Robson a786cfe09b Templates: Reorganize pinned containers
The UnpinnedContainer and PinnedContainer are versions of the
same component but with different states. Recognize them by
organizing them in the same subfolder. Update all existing usages.

Bug: T317900
Change-Id: I2c25937190997764fa23e0b581be5538ba4d06de
2022-12-09 16:56:06 -08:00
bwang 81348a659c Remove TOC AB test code
While removing this we also noticed that we check the value of
isMainPage. This doesn't seem like a good idea as most main pages
do not have a table of contents, so it seems like adding
unnecessary complexity for a state that doesn't exist in practice.
The existing code path also doesn't work as it adds a table of contents
unstyled to the page.

Bug: T324874
Change-Id: Idaeff6ace5912ea74ed9d335526027c4690ac8fa
2022-12-09 16:07:52 -08:00
Jan Drewniak 0baf4b18dd Follow-up to c1ebfd58, retrieve first value of array_splice
Follow-up to c1ebfd58, when removing the toolbox menu from
the sidebar, calls current() on the value of array_splice()
in order to return the actual toolbox menu data,
instead of an array containing that data.

Bug: T318434
Change-Id: I79fd0f98cb1491dec0810408ad91c7a855cea9cf
2022-12-09 20:05:23 +00:00
Nicholas Ray 24055a6752 Set default pinnable state for page tools
* Leverage the infrastructure around feature management to handle the page tools
pinning and persistence

* Make pinnableHeader.js leverage features.js if the data-feature-name attribute
is set

* Sets tests/.eslintrc.json ecmaVersion to 2018 to enable destructuring in test
files.

* Adds a isPinned helper method to pinnableElement

* Add a logged in requirement so that the pinned feature is disabled for
anon users.

Bug: T322051
Change-Id: Ib86282216882fa94e37b7088a3f4bd0c1bcf6cd4
2022-12-08 14:44:07 -07:00
Jon Robson c1ebfd587c MainMenu: Print menu now displays in main menu
Our previous use of unset was leaving an undefined index of 0 in
the array of portlet links.

Use array_splice instead so we update keys.

This removes the "phantom" main menu that is displaying in the
main menu when the print menu is enabled.

Bug: T318434
Change-Id: I59d9f00636a6302a679599a2b829cd107980a1e3
2022-12-08 11:26:03 -08:00
Jon Robson a7f008b9bc Page tools: Main menu is a dropdown
This is an incomplete styling of the menu.

This should be enough to start an initial design
review and unblock other work on the dropdown.

Out of scope for this patch:
- Pinning (being done in T317900)
- Design (will be done in follow up)

This should cause no visual regressions in Pixel.

Bug: T317899
Change-Id: Id7b47cc16fc8cf93d406687198ba37acf7a9cf24
2022-12-07 23:19:29 +00:00
Jon Robson bcb2a73ba1 Introduce UserLinks and LanguageButton components
Bug: T322089
Change-Id: I0bf504b2c9c129ef56c95c2370204ee20a41bd7a
2022-12-07 20:01:36 +00:00