Commit graph

760 commits

Author SHA1 Message Date
jenkins-bot df7c22088c Merge "Fix casing of dropdown-related less file" 2024-03-11 13:41:03 +00:00
Umherirrender 88b78b247c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I693651564cc544b881e1a45ea8abeff8d58d8fb6
2024-03-11 00:34:07 +01:00
Umherirrender e82d8e7121 Fix casing of dropdown-related less file
Follow-Up: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
Change-Id: I4c310770af6039cfa7931f4319571c77d35b9ef6
2024-03-09 15:45:32 +01:00
jenkins-bot 201cad0f66 Merge "Inject service LanguageConverterFactory in LanguagesHelper" 2024-03-08 20:44:55 +00:00
Fomafix fd0e6d4e4c Implement PreferencesGetLayoutHook
Change-Id: Iccf0fa1ba5b4c547a221f2d152f0f387f04848a2
2024-03-03 14:40:39 +00:00
Fomafix 52583a336d Inject service LanguageConverterFactory in LanguagesHelper
Change-Id: I2fd1b4c3b25a94cca59d08216390652759859a62
2024-03-03 13:00:31 +00:00
jenkins-bot a46ac64378 Merge "Inject services in SkinMinerva" 2024-03-01 19:24:58 +00:00
jenkins-bot 1067ea5a2c Merge "Inject service UserIdentityUtils in DefaultMainMenuBuilder" 2024-03-01 19:01:43 +00:00
jenkins-bot ff82ad0428 Merge "Inject services in Hooks and MobileFrontendHooks" 2024-03-01 18:58:40 +00:00
Fomafix 4e6c1a87b3 Inject services in SkinMinerva
Change-Id: I17ae52ab9bb251a501d9de38f8a7051118f9622e
2024-02-29 21:34:15 +00:00
Fomafix e812a6b727 Improve PHP code style
* Remove phpcs rule exception
  MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment.
* Update or remove the comments not matching the rule.
* Fix double tab indention.

Change-Id: I68c43fe0db9384edfaaf64a155e904d629c7ade1
2024-02-28 08:59:17 +00:00
Fomafix 2d65be33ab Inject service UserIdentityUtils in DefaultMainMenuBuilder
Change-Id: I5f21dac80707a0dbc81ee8910feee74108363624
2024-02-27 14:48:47 +00:00
Fomafix 0f8800ac42 Inject services in Hooks and MobileFrontendHooks
Change-Id: I8e0673689c2dbe14a385bbd1fe1725d203386bde
2024-02-27 10:15:03 +00:00
Fomafix 3bb9611497 Replace global variable by config
Use $this->overrideConfigValues instead of $this->setMwGlobals in the
test.

Change-Id: I1ae238235476a001683ea81d2b65d209a2774549
2024-02-27 06:45:34 +00:00
Fomafix 248180ef03 Inject service WatchlistManager into MinervaPagePermissions
Change-Id: Id41c85c8e119efbf9814be25ba659f1da1151eb4
2024-02-26 07:53:03 +00:00
Jon Robson b079031b0a Send a toast notification if night mode is not available
Add a skin-night-mode-page-disabled class to the HTML element when
a page was disabled by the new MinervaNightModeOptions configuration
flag.

Bug: T356653
Change-Id: I7a6582ef8f66e78cc6f07da06bc4d2a3277cfcf0
2024-02-14 01:51:23 +00:00
libraryupgrader b7cc09b4a3 build: Updating mediawiki/mediawiki-phan-config to 0.14.0
Change-Id: Ib3c5f368f8205728cec4e28c3b832fdc6060a093
2024-02-10 16:03:06 +00:00
jenkins-bot 8dbb6d0be6 Allow pages to not appear in night mode
- Add config to skin.json
- Add the function in SkinMinerva.php to check exclusion of pages and namespaces.

Bug: T355705
Change-Id: I0fa0eab3bfa57cc6864dbdd2d6aeaa5582767c3c
2024-02-08 21:28:14 +01:00
Steph Toyofuku 573ac59dc5 Query params can set night mode value
Whereas previously, the value of the query param would simply determine
whether or not night mode was enabled, we would like to be able to
control the actual night mode setting off of the query param

Now, it functions as an option to force the user into a particular
setting, be it automatic, night, or day.  If the query param is not set
(if night mode is enabled via config), we will default to the user
option as before

Bug: T355118
Change-Id: I38ed94bfc1b80d0a827c63c6dbdd92eb6f1bf531
2024-02-05 14:45:49 -08:00
Steph Toyofuku ef46f238a7 Set up user option for night mode
Add a new user option, `minerva-night-mode`, and configure it with a
default value of 2 (automatic based on OS).  Rework the code in
`getHtmlElementAttributes` to set the initial class value according to
the user option, which will be set and saved inside of MobileFrontend

Bug: T355118
Change-Id: I4b0d63a186f490ba10b7655b3af4dcb8b64bd400
2024-02-02 13:28:35 -08:00
Jan Drewniak 59fd0cd5dc Convert all color related Less variables to CSS custom properties
All colors used in Minerva are converted from Less variables
into CSS custom properties. A new file called CSSCustomProperties.less
is created in the skins.minerva.base.styles module to store
these custom properties and an ADR is provided on the rationale for
dropping support for browsers that don't support custom properties.

The new CSS custom properties follow Codex design token conventions
where possible (and noted when not).

Link colors are unique because their styles are defined in core,
so in that case the Less variables values are set to custom properties.
Those values are then fed back into MediaWiki core for core link
styling.

Also adds a temporary night-mode color palette under the
.skin-nightmode-1 class on the <html> element.

Bug: T356074
Change-Id: Ida1f14138f12bd3c600c264bde7b5100f9dbf4ff
2024-02-02 17:57:27 +00:00
Jan Drewniak be0b43042e Convert Less variable names from camelCase to snake-case
Converts all Less variable names from CamelCase to snake-case
per the MediaWiki coding conventions.

Removes the following unused Less variables, mostly
related to icons, since those were converted to Codex:
- @icon-touch-area-sm
- @icon-touch-area-md
- @min-size-icon (replaced with @size-icon-medium)
- @icon-glyph-size-sm
- @icon-size-sm
- @icon-padding-sm
- @icon-glyph-size-md
- @icon-size-md
- @margin-icon-md-labelled

Bug: T350581
Change-Id: I1b16e77942d9bea20dcc5636a63d64aa2325a173
2024-01-31 15:24:31 -08:00
Steph Toyofuku f614ce6687 Add feature flag for night mode
Adds a config flag, `MinervaNightMode`, and wires it up as a skin option
for enabling/disabling the night mode toggle (sold separately)

Additionally, allow this feature to be enabled via the
`minervanightmode` query param

For now, turning the flag on will result in the class
`skin-nightmode-clientpref-1` being added to the HTML element, but in a
later change this will be updated to switch values based on the
forthcoming client pref

Bug: T355118
Change-Id: I35848ab80ee75d324ceb35d17794e2d3e620cc19
2024-01-31 00:38:51 +00:00
Jon Robson 568ab16285 Fix styling of tabs on history and diff pages
On English Wikipedia, talk tabs are enabled so this went undetected.
The history and diff pages should be loading these styles since they
both have tabs.

Bug: T356117
Change-Id: I380cc4ba9a4f809e4400873241d97de5a5fe6c1f
2024-01-29 23:04:12 +00:00
Jon Robson a62f1e06ff Update checkboxHack target node
CHECKBOX_HACK_TARGET_SELECTOR only applies to the first list
and there are three lists in the menu. Use the parent instead.

Additional changes:
* Transform to ES6 while working on this code.

Bug: T354315
Change-Id: I354e33af872e9a2f93d97793f5f33b735d42e804
2024-01-12 08:00:59 -08:00
Umherirrender 1ad05f4a2e Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I1eec0823b7af97ea5031ff00b111e0c88b45a155
2024-01-06 16:31:38 +01:00
Steph Toyofuku 2b41416c0d Allow addPortletLink to target tabs/associated pages
Currently `mw.util.addPortletLink` cannot properly add a portlet link to
the associated pages tabs, as there is no `p-associated-pages` id on
mobile.  This change pulls the id from the page data, and adds the
necessary class for the tab to be styled correctly - since tabs do not
have corresponding icons while most portlet links do, we also branch on
this class (effectively on whether we are in the tab container) to
ensure an icon is not inserted

Finally, I added a few comments and spacing in the sections of code that
I touched to make them more readable and resolve some of the linter
warnings, but happy to hear if these are not helpful!

Bug: T340728
Change-Id: I33fc12611a6238552a3eb47f6ca37f087903a92a
2023-12-21 16:37:28 -08:00
Steph Toyofuku 88caf181e5 Rework tabs to use unordered list
As part of my work on fixing addPortletLink for tabs on mobile (T340728)
we need these tabs to be correctly designated as an unordered list (note,
this is also how they are rendered in Vector).  In addition, update the
styles to account for the link being nested in a list item now

There should be no visual change as a result of this, but if there is
please let me know!!  I will be testing locally in pixel after pushing
to ensure the change is transparent

Bug: T340728
Change-Id: I922558a59aa909ce76079bab057811d76467f644
2023-12-19 15:28:11 -08:00
Steph Toyofuku 5e35d585cf Fix alignment for nearby and settings items in menu, and correctly hide when JS is disabled
Removes a `display: inherit` that was causing issues with the alignment of these two items in the menu.  In addition, correctly sets display to none for jsonly-specified list items when client js is disabled and rename the class to make it more specific to the menu items

Note: this will have a visual impact as it is fixing what is currently a visual bug.  The jsonly hiding will also not work with cached content, but since it's currently broken we figured this was acceptable

Bug: T346670
Change-Id: I56d2c4fcba09d199a0fd6aad2f1621509bbfaba5
2023-12-14 21:58:39 +00:00
Jon Robson d3b3b93d18 Show tabs on history page
Bug: T353403
Change-Id: I1a9090add87a3ba584a37381fd85f8b52e1f193a
2023-12-13 14:30:55 -10:00
Umherirrender b67f2800d3 Swap conditions in onSpecialPageBeforeExecute
Avoid use of the context when not needed as this is also called for
special page transclusion, avoid initialize of the skin in that newly
created context.

Change-Id: I56573491262a194f44bccb7fd6170eb7bf21c6ed
2023-12-06 20:18:52 +01:00
gerritbot 6419c847e9 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I5a540772aafd2c4686e02f748b5fc61155920397
2023-11-29 12:41:59 +00:00
Jon Robson 99b32fb309 Omit the last modified bar in the HTML rather than hiding it via CSS
The mediawiki.diff.styles can be loaded on pages other than the diff
page itself, so it is better to move this logic into SkinMinerva and
avoid outputting it for diff pages full stop.

Note this module is loaded on Special:MobileDiff and desktop
Minerva history page (without redirect) so we need to cater
for both cases.

Bug: T350515
Change-Id: If2d908b7cbe257184e0c899f78a04d4d5935ea8c
2023-11-06 19:48:25 +00:00
jenkins-bot 3a4b1f1082 Merge "Style the desktop diff and history page of Minerva to look like mobile pages" 2023-10-30 14:53:32 +00:00
jenkins-bot 16eed12b1a Merge "Generate section edit links via SkinMustache" 2023-10-24 01:12:49 +00:00
Jon Robson 0c8caebfc6 Generate section edit links via SkinMustache
Bug: T346944
Depends-On: Ief6a6ee03ada8207fc5c60ea438412fa2d529022
Change-Id: I9f768706c0a0f14f14ee4b3812288218bef36018
2023-10-23 23:17:43 +00:00
jenkins-bot 47d023c767 Merge "Do not use data-mw=interface when watchstar is used as a CTA" 2023-10-23 21:14:54 +00:00
Martin Urbanec 8b04c45fb2 Do not use data-mw=interface when watchstar is used as a CTA
Why:
Minerva uses watchstar both as a client to action=watch
and as a CTA prompting users to create a new account.
To prevent error messages about permissions from being
displayed when logged in as a temp account (or not logged in
at all), the API requests should be only sent when users
actually has watchlist permissions.

This patch fixes that by only passing data-mw=interface when
the watchstar is actually used as part of MW watchlist interface,
ie. when user is logged in. That means the `mediawiki.page.watch.ajax`
module in core can avoid the watchstar element when it is not meant
as a watchstar, but as a "sign up" CTA button.

What:
* Make it possible to change (or omit) data-mw in SingleMenuEntry
  by a new constructor parameter.
* Make ToolbarBuilder::createWatchPageAction omit data-mw when
  user does not have watchlist permissions.

Notes: Based on coversation with Krinkle in
Ia0acdaf4dea5aa6788f89fdd73c5dba9af9f1ed7.

Bug: T344925
Change-Id: Id9d6d9e7394b52d11ac6ce0b7d33319b3a761789
2023-10-23 08:59:08 +02:00
Umherirrender dd5753c023 Replace empty() with falsy check
empty() should only be used to suppress errors
When the type of the variable is array,
a falsy check is the same (checks for null, false and empty array)
Found by a new phan plugin (T234237)

Change-Id: If24015795219f6ff4f155c0d667472dc52a04d43
2023-10-21 20:29:41 +02:00
Jon Robson a3f03245fd Style the desktop diff and history page of Minerva to look like mobile pages
Depends-On: Ie8ac1aab6d2fe5f4575a6891c36efe497458e093
Bug: T305113
Bug: T240624
Change-Id: I5a4a2588da3d701be87690038c2c9b2bc1aa0365
2023-10-20 18:35:10 +00:00
Ed Sanders a8aecda711 Udate jsdoc and use jsdoc-wmf-theme
Depends-On: Ic3861870c10f64d7f5414669a9d25b8ffb4c79a4
Change-Id: I6750e9bb6d5409e497b5605e3a4660734f5677ab
2023-10-20 13:42:19 +00:00
Jon Robson 7d59aa1843 Restore watchstar for anonymous users
Minerva shows a watchstar for anonymous users.

Follow up to
I3c9d59f49f1b939981a7b2b450448db6736d5958

Bug: T348336
Change-Id: I36afb86f0c89c30dcb7695e1409f7c20d3dc31d1
2023-10-06 18:05:08 +00:00
jenkins-bot 50563c1b23 Merge "Support extension of page actions via hook and addPortletLink" 2023-10-05 00:23:01 +00:00
Jon Robson 05231bb254 Support extension of page actions via hook and addPortletLink
This adds support for:
mw.util.addPortletLink('p-views', '#', 'text', 'fooz',null,
  null,'#page-actions-overflow' )

and adding multiple edit icons via hooks.

Depends-On: I655097769620301143140ded1cde4c7a16879ef4
Depends-On: I401805224c0f387ac85b52b50c1f298b83c03a91
Bug: T346944
Change-Id: I3c9d59f49f1b939981a7b2b450448db6736d5958
2023-10-04 22:15:47 +00:00
MusikAnimal 907e40d5c9 ToggleListItem: correct {{class}} to {{classes}}
This fixes the integration added with Ice909aab7f.

Bug: T242467
Change-Id: I8920e0878f676885a795fca8bfd2dc63ec1140cb
2023-10-03 16:42:29 -04:00
Jon Robson b51c6511ef Fixes history icon in green last modified bar
Currently the last modified bar icon appears black rather than
white. This is because the last modified icon shares icon CSS
with the page actions in AMC.

Untie these by giving the icon in this context a different selector,
taking care to support cached HTML.

Change-Id: I98443b0dcb88911a5314092216809387b4fb80dc
2023-09-25 20:40:55 +00:00
Jon Robson 658f1c3439 Fix Echo badges on desktop Minerva, remove module
Bug: T345785
Change-Id: I2913c60d609a11fa74d90e858bf112627553aa13
2023-09-11 14:35:40 -05:00
bwang 269bd5bdaf Remove old :before icon selectors and update selectors to not use minerva and wikimedia prefixes
Bug: T344022
Change-Id: I573d7b36513cd0b74f62621cc246f719bcb94256
2023-09-06 13:53:22 -05:00
bwang 0e391a87e0 Update addPortletLink for Codex
For testing make sure to check the 3 variants:
```
mw.util.addPortletLink('page-actions', '#', 'text' );
mw.util.addPortletLink('p-interaction', '#', 'text' );
mw.util.addPortletLink('p-personal', '#', 'text' );
```

Bug: T344006
Change-Id: Iad3a8d5ed1237c1438d170f07c9c3fe3784182fe
2023-08-29 19:27:56 +00:00
bwang 7bbb240db1 Make menuGroup.mustache use togglelist classes, ensuring ToggleList HTML is consistent. Remove duplicated CSS
Bug: T343920
Change-Id: I567d20171b0e511d00922adf250f97b9b8ed146b
2023-08-25 17:57:47 +00:00