As Stephen pointed out somewhere, this is a bit of a micro-optimisation
Let's simplify this code by always rendering it in the HTML. MainMenu.js
as a result becomes a controller that just decides when to show it.
The geolocation check for Nearby is removed given the fact that all
grade A browsers for mediawiki have Geolocation support
Additional changes
* Browser support suggests "animations" class is redundant now
* `open` event no longer filed - not being used anywhere
* Transparent shield is now managed by the MainMenu controller not
the skin (which was confusing)
* Test geolocation using a simple feature tests
rather than abstracting it away inside Browser
* The main menu button is always hidden under either a translucent shield
and/or the main menu itself when it has been opened
so so it's not possible to ever click it while the menu is open
- the click handler is thus simplified
removing a check for the class of the button
Depends-On: I7fd243366cceae780bd46e1aef2c08dae073f647
Change-Id: I3892afb5ed3df628e2845043cf3bbc22a9928921
If JS is disabled and you are logged in, no icon shows.
Icon class is incorrect.
I also update the test.
Change-Id: I786ced58171f4ffb4a9d75dcfc6f993647399065
Brings the last-modified toolbar (links to history page at the bottom
of articles) in line with recent icon changes. Removes the icon
class from the toolbar itself and by employing a flexbox layout,
reducing the amount of CSS required for this toolbar.
Bug: T233172
Change-Id: I27658477aaeed3290aced844caa64fc5e1c34fbd
Logic is moved from server to client. Config is added via getSkinConfigVariables (e.g.
passed to mw.config ) and a JavaScript if statement.
The IIFE in watchstar and talk files is replaced with a module.exports function to avoid
refactoring at this point and added risk. The file contents remain the same.
skins.minerva.options is left as is, given the code is more experimental and used in
the beta mode - should not be sent to all clients.
Additional change:
* Remove skins.minerva.toggling (that module has been empty for a week now and functionality
moved to mobile.init module)
Depends-On: Ie71adbe18e8dbeb661ddb9d7d3d1d0897891d515
Bug: T233048
Change-Id: Ife777e76d9d77894fb5d09e7c8f0238b00596a7a
uses the CSS :last-child selector to align the last item in the header
with the edge of the container.
This is usually the notification icon in "normal" mode and
the user menu icon in AMC mode.
Bug: T229440
Change-Id: I4430f5659093f76896e2b86e076526a0b51d9630
To accommodate for cached HTML a new class last-modified-bar__text
replaces last-modifier-tagline to help us distinguish between old
out dated HTML and the new HTML.
Bug: T232792
Bug: T232800
Change-Id: I53fa45058dbc81c91089840073e03113ff1a4b9c
Includes icon fixes and removal of some CSS overrides.
This causes the following temporary defects to the skin:
* Last modified bar will temporarily be squashed
* clear search icon will be misaligned vertically
Depends-On: Ie811d25595d041c35e6c214190101821f3a5d466
Bug: T229440
Change-Id: I0a3a73421791ad353bbcebaeb8241ad062f67ae4
Note: this agitates T230232 again - when merging this please
make sure a merge for I929090848f3e04647a97f4979ec78682623fa070
is pending.
In various places we try to override the default mw-ui-icon behaviours
The hacks need to be removed as part of addressing the core problem.
Changes:
* Wherever we use mw-ui-icon-before in PHP - wrap the label with a span
so that label font-size is altered where needed - not the icon
* Where a small icon is needed us isSmall parameter for the Icon component
* Apply font-size to labels of mw-ui-icon-before elements
* The browser tests need a slight update to access the span element inside
a menu item - in the case of the logout button the label is always hidden,
so we need to check the visibility of the parent element (secondary_action)
Bug: T229440
Depends-On: I3f803ec4c9068b30aa93b803391aa4d65d8310ff
Change-Id: I07e4ae233979636b739f1117dd7703571e0a9366
When a user is blocked, only present the "locked" page edit link. Omit
the section edit links entirely.
The logic for checking user permissions already existed in
ToolbarBuilder. Move this logic to MinervaPagePermissions and add a new
"EDIT_OR_CREATE" action distinct from IMinervaPagePermissions::EDIT.
These names will be revisited in a following patch.
Bug: T206265
Change-Id: Ia43a670a259cabc313c004fe06c91e078bd41562
Currently a bunch of icons are loaded for all users that are only
ever used for AMC. Clean this up and add notes on the necessary steps
if these ever become the default.
Bug: T229295
Change-Id: I4e16028e7121b0b3e1a60b9404183d483db52ad8
Changes:
- added support of event-data-name to toggle list and all menu
entries
- track main menu open actions
- prefix all menu interactions with `menu.`
- prefix menu opening with `ui.`
- track tab clicks (also a part of new ui)
- track notification icon clicks
We're not tracking the Download icon as it has it's own
instrumentation.
Bug: T220016
Change-Id: I442103c1f8967c6710429329f024f266c9b11ea6
Two new feature flags:
1) MinervaPersonalMenu
2) MinervaAdvancedMainMenu
Changes:
* AMC defaults to false on desktop - desktop doesn't have AMC mode it just
enables several skin options.
* WHen inserting a link at the bottom of the page check whether the talk at top
of the page (tabs) is enabled.. not AMC
* Update ServiceWiring to construct menu based on MinervaAdvancedMainMenu
and MinervaPersonalMenu - note when former is enabled but not latter there is
no way to logout. Noted in README.
* Use one entry point for skins.minerva.amc.styles/index.less
* Document files inside skins.minerva.amc.styles to make it clear which features
they are associated with
* Drop history page styles when AMC is disabled - it's not possible to ever get to
these as the history page redirects in non-AMC mode
* Rename the class .minerva--amc-enabled to minerva--history-page-action-enabled
to reflect its real purpose and move styles from skins.minerva.base.styles to skins.minerva.amc.styles
No need to worry about cached HTML as AMC runs without cache...
* Remove isAnyAMCOptionEnabled - it's an antipattern and should be discouraged as it discourages the
art of feature flagging. Nothing is using it after these changes.
* The AMC_MODE flag is disabled. There is no need for this - AMC is not a feature and therefore not a
skin option. It is a mechanism for turning on other skin options. Tests are updated.
Testing:
It should now be possible to enable any feature in `beta` and see it in the beta of the
site.
Bug: T229295
Change-Id: I48959905f5c09721b14a27aa1a5ad82849ac6263
Changes:
- Title::getTalkPage() is deprecated, use NamespaceInfo instead
- Title::getSubjectPage() is deprecated, use NamespaceInfo instead
Note: NamespaceInfo returns LinkTarget instance, but most of our
logic is wrapped around Titles, that's why we need to call
Title::newFromLinkTarget() to be sure that we got Title object.
Change-Id: Ibf2237ea369b0cee67ab5f623bdddcd9058eec3e
Do not hardcode special handling of Options in other places
than SkinOptions. SkinOptions should be only one place that
knows all interpedences.
Change-Id: I9ad8c1560332665dbcd88ccc7105fb253a2f41b9
For better readability Main Menu building classes should
contain MainMenu in the name as not everyone uses smart
IDEs.
Change-Id: Ica3bf4bbd18cab1a6cd88061dfb9d1ce51b0f63d
It feels like the comment about history link time should be located
next to the getHistoryLink function, not somewhere in the code.
Statements like:
if ( a ) {
if ( b ) {
// do sth;
}
}
can be easily wrapped into:
if ( a && b ) {
// do sth
}
Change-Id: I98c071ecdd855210bc0a92f032ee622fb91e8df5
The main menu icons are needed in the user menu by the no-JavaScript
desktop Minerva experience which does not have an active
SkinOptions::OPTION_OVERFLOW_SUBMENU option. This was introduced in
Ic6a2490fbd3903c5d34ff8267d745fdd93c73fd2.
Bug: T214540
Change-Id: I780e5639057f236d6ff91675f82cf4682520021a
* New module skins.minerva.icons.wikimedia provides icons
from Wikimedia UI in Minerva
* search selector in skins.minerva.content.styles.images is
retained for cached HTML
* skins.minerva.icons.loggedin now a
ResourceLoaderOOUIIconPackModule and bell removed from repo.
* userAvatar replaced with userAvatarOutline
Bug: T224070
Change-Id: Ibed609371060acc4b69e5cd4cd4f20edc871b3ba
Changes:
- We should limit the interfaces we pass around,
AdvancedUserMenuBuilder doesn't need whole IContextSource as it
uses only msg() method. It's better to define that this methods
needs only MessageLocalizer
- move UserMenuDirector into ServiceWiring to be consistent with
other Directors/Builders
- pass PersonalTools as a dependency to UserMenuDirector, which
will pass to each Builder. The personalTools is set of links
that can/should be used when rendering user menu (which in the
fact has almost same subset of tools as the personal toolbox)
Bug: T214540
Change-Id: I7f744651b0665452a5a9d1ce661f20547e80812d
Add new user menu. The changes required include:
- Break up AuthMenuEntry into reusable components. They're now simple,
independent, static functions in AuthUtil that are easy to reason
about and compose.
There's lots of verbose code because of the builder and director
patterns. That is, most of the code is for building the thing we
actually want to build instead of just building it. It's easy to write
but no fun to read--even simple configurations are extremely verbose
expressions that must be threaded through the system.
These builders are also single purpose and unlikely to be reusable
unlike a URI builder, for example. As objects, they're not especially
composable either.
- Similarly, break up Menu/DefaultBuilder into BuilderUtil and ban
inheritance. Inheritance has not worked well on the frontend of
MobileFrontend. I don't think it's going to work well here. E.g., I
could have made changes to the base class' getPersonalTools() method
such that the client passes a parameter for the advanced config or
maybe I just override it in the subclass. In either case, I think it
makes the whole hierarchy nuanced and harder to reason about for
something that should be simple.
- Add ProfileMenuEntry and LogOutMenuEntry for the user menu.
- Rename insertLogInOutMenuItem() to insertAuthMenuItem() which matches
the entry name, AuthMenuEntry.
- Extension:SandboxLink is needed to display the sandbox link in the
user menu.
- Performance note: the toolbar is now processed in MinervaTemplate,
which corresponds to removing the buildPersonalUrls() override.
- To mimic the design of main menu, the following steps would be
necessary:
1. Create a user/Default and user/Advanced user menu builder and also
a user/IBuilder interface.
2. Create a user/Director.
3. Create a service entry for Minerva.Menu.UserDirector in
ServiceWiring. The Director is actually powerless and doesn't get
to make any decisions--the appropriate builder is passed in from
ServiceWiring which checks the mode.
4. Access the service in SkinMinerva to set a userMenuHTML data member
on the Minerva QuickTemplate.
5. In MinervaTemplate, access the userMenuHTML QuickTemplate member
and do the usual song and dance of inflating a Mustache template.
This patch does everything except add a service, which was agreed to
be unnecessary, so that logic is now in SkinMinerva.
- Wrap the existing echo user notifications button and new user menu
button in a nav element. This seems like a semantic improvement.
- The existing styling and logic for the search bar and search overlay
are pretty messy and delicate. Changes made to that LESS endeavored to
be surgical. There's lots of room for improvement in the toolbar but
it's out of scope.
- Rename logout icon to logOut.
Bug: T214540
Change-Id: Ib517864fcf4e4d611e05525a6358ee6662fe4e05
The $hasLangauges and $hasVariants checks were used in couple places,
which lead to the same code used in many places.
Following the DRY rule, let's implement a Service that can do that
check, and use that service everywhere in code.
Bug: T224735
Change-Id: I46d58758356e870c408a74b2c087a42d6ad0ddea
The icons for the main menu are not needing for the first render,
they have thus always been loaded via JS. While this means the
menu icons do not load for non-JS users, Special:MobileMenu fulfils
that purpose. With AMC we'll need to reconsider this approach
but the 1.8kb added by this module is not acceptable.
Bug: T227929
Change-Id: Ic6a2490fbd3903c5d34ff8267d745fdd93c73fd2
Help with readability by using module.exports and require rather than the MobileFrontend
provided mw.mobileFrontend module manager (and avoid adopting webpack at this time)
Replace usages of mw.mobileFrontend.require with local require and module.exports
(compatible with RL or Node implementation)
Changes:
* Notifications modules are merged into skins.minerva.scripts and initialised
via a client side check.
* new file overlayManager for exporting an overlayManager singleton
rather than being hidden inside resources/skins.minerva.scripts/init.js
* All M.define/M.requires swapped out for require where possible
The `define` method is now forbidden in the repo.
Bug: T212944
Change-Id: I44790dd3fc6fe42bb502d79c39c4081c223bf2b1
These have leaked into all users experience.
The CSS appears to be unused outside AMC.
Also remove a reference to skins.minerva.share
which does not exist.
See I171831469a6733c458bc5c7ba249a5096ca975b8 which introduced these
styles.
Bug: T227929
Change-Id: I6af6b026e68e11327b7c4e3edfc4f812c7309e2e
A list that toggles visibility via the checkbox hack is needed in at
least two spots: the page actions overflow menu and the user menu. This
patch makes several refactors to turn what was previously hardcoded into
page actions a reusable component:
- Start a new components directory. Components are reusable and
composable. The subdirectories are organized by function, not
ResourceLoader module bundling which greatly improves the ability to
see a component's full functionality in one directory instead of
examining the entire codebase. See updates to README.
- Extract pageactions.less into:
- ToggleList.less: LESS for any checkbox hack list.
- DropDownList.less: LESS for lists that open downwards.
- MenuListItem.less: LESS for list items of menus.
The division makes it easier to see concerns, dependencies, and change
code.
- Move pageActionMenu.mustache to a component and extract ToggleList
template.
- Extract ToggleList.js from Toolbar.js.
Bug: T214540
Change-Id: I171831469a6733c458bc5c7ba249a5096ca975b8