Commit graph

404 commits

Author SHA1 Message Date
jdlrobson 534bca9e5f Cleanup: Remove unnecessary lazy loading wire up code
Lazy loading images is now untangled from the Skin code so there is
no reason to call this anymore.

Lazy loading image is a MobileFrontend responsibility not a Minerva.
Minerva doesn't need to know anything about it.

Bug: T246838
Depends-On:  Ibeee7cae4b85ba888d0fecccdeec232ddd4cde0f
Change-Id: I4c4ef896b81ee494637a64d1087faa62a6f7c589
2020-05-26 19:10:26 +00:00
Jan Drewniak 145d23ee0f Exclude localStorage errors from error-logging
Bug: T253084
Change-Id: I1117be62d5a5ae0725836fae49fd325a07b0f83d
2020-05-26 13:08:48 +02:00
Bartosz Dziewoński a1e75213da Fix posting talk page replies on pages with subsections
The MobileFrontend section numbers that were used here only count
top-level sections, but this value was passed to code in
MobileFrontend's TalkSectionOverlay#onSaveClick, which uses an API
expecting the standard MediaWiki section numbers.

Extract the section number from the section edit link, like we do
in mobile.init/editor.js in MobileFrontend.

Also, disable the special talk page view unless we're viewing the
latest revision of the page. That could also lead to posting in the
wrong section, as sections are often added and removed, which changes
the numbers.

Bug: T252828
Change-Id: I553a508658804dd8672f2268b7118f77458a9dba
2020-05-14 22:57:00 +02:00
Sohom Datta 312b52cfb5 Replacing instances of toast.show() with mw.notify()
Replacing toast.show() with mw.notify() as per change 594766

Bug: T212542
Change-Id: Ibb2bb28a8898979754a924305e67e23bc019f663
2020-05-13 16:59:07 +05:30
Jan Drewniak 5144e73313 Remove "last-modified-bar__text" as a JS selector
When enchancing the watchlist items with the "time ago"
feature, the "last-modified-bar__text" class is added
to the element, which could have unexpected consequences.

That class is removed from the watchlist and instead
of using it as a JS selector, the `modified-enhancement`
class is used for both the watchlist and last-modified
bar.

Change-Id: I4a157adf51b9ed45bcba977f4f6622c7991471ba
2020-04-30 16:17:23 +02:00
Volker E 18ab61d4fe Use .text-overflow() mixin from 'mediawiki.mixins'
Removing MinervaNeue's own mixin now that it's possible.
Also unify code instances to use new mixin.

Depends-On: Ia8d6e7229b49598b0f4cb19dff463ffe2f11a43d
Change-Id: Iaffcefcb7a239d5ddecbe17097573d06099de88e
2020-04-21 11:49:30 -07:00
jdlrobson 2e32f41fd3 Drop skins.minerva.icons.image module now cache has cleared
Bug: T244444
Change-Id: I181d41f60481efa904d5e951cf08480bbae82015
2020-04-10 17:36:46 +00:00
jdlrobson 276ae636fe Use standardized icon classes and fix some missing icons
The icon pack wikimedia.ui was strangely using a non-standard
icon class using empty strings as a way to disable the default behaviour
of setIcon. Instead of fighting APIs - use the methods available.

The icon pack is also renamed to reflect what it's actually used for -
providing icons for overflow menus and it is no longer loaded as a dependency
by skins.minerva.scripts

Fixes issues with:
* History icon with AMC disabled and user is logged in
* Table of contents icon
* Language icon when it appears in overflow menu on user pages
when logged in where AMC is disabled
* listBullet appears in 2 modules as it is used in 2 places - the AMC
overflow menu (log icon on user overflow menu) and for table of contents
(JS only)

Bug: T232383
Change-Id: I05220ffa56195be6a594e3a8a57ae16858088444
2020-04-02 01:37:33 +00:00
Volker E 98d3225fc8 Rename several icons to WikimediaUI naming
Renaming to WikimediaUI standard naming and adding to module
skins.minerva.icons.wikimedia which is loaded via addModuleStyles
 'edit' → 'editLock'
 'edit-enabled' → 'edit'
 'toc' → 'listBullet' (already included in wikimedia.ui module)
 'mainmenu' → 'menu'
 'language-switcher' → 'language'
 'clock' → 'history'

Icon `page-actions-overflow` which is only needed on AMC is moved out of the stable icon
pack and added to skins.minerva.mainMenu.advanced.icons temporarily which is loaded on AMC pages only:
 'page-actions-overflow'

Additional changes:
* Renaming 'clockIconClass' to 'historyIconClass' to stay on name.
* Module `skins.minerva.icons.images` is deprecated and shipped for old
HTML markup. It will be removed in 2 weeks.

Bug: T232383
Change-Id: Ia3bafc74a85293c2414c0ef4ccf3bb20c75135d1
2020-03-31 11:48:57 -07:00
Volker E 28361446f9 Remove obsolete fallback CSS classes
Introduced in I0f929f2f3b11362

Bug: T244444
Change-Id: I7e45adf0549c35aaa0c8390329e20d205126f616
2020-03-26 17:52:58 -07:00
jdlrobson 1200cb5279 Storybook added to MinervaNeue
For now just adding story entries for footer element and last modified.

Bug: T244106
Change-Id: Ib36f22f9b9d805f87fc074d12473497cfaf91b79
2020-03-03 15:22:34 +00:00
jdlrobson fb36687fc3 setAttribute takes a string not an array
Since we are dealing with arrays here with the value of classes
but using native DOMElement we need to convert the array to a string

Follow up to  I331912a1cd6cd4293c22a1a48bb32cdec48bd37d

Change-Id: If08d68af8cebecaea02cc29bf779d25d58c0c6c3
2020-03-02 12:05:42 -08:00
jdlrobson 6b6c6b8d6e Menu items added via addPortletLinks should look like other menu items
Requires `I4c477c88ce48484960e40609cd243e63639175bc` to function.

Bug: T236711
Change-Id: I331912a1cd6cd4293c22a1a48bb32cdec48bd37d
2020-02-29 00:11:28 +00:00
jenkins-bot 30fac0ca85 Merge "Do not allow raw HTML in talk page overlay header" 2020-02-18 23:48:37 +00:00
jdlrobson 7f47dff5e5 Use icons in skins.minerva.mainMenu.icons from OOUI
For all mainMenu icons pull from OOUI icon packs.

We make the necessary changes to Definitions.php, ToolbarBuilder
and LogoutMenuEntry to ensure to update icon glyph names.

There are caching implications for icons that show to anonymous users -
these have been fixed for grade A browsers running JS by appending the
new class to impacted elements.

Grade C browsers being served cached HTML will not benefit from this
emporary fix as available solutions are costly.
As a result these users will not see icons until the cache
expires (maximum of 4 weeks but likely 1 week) or is flushed via
action=purge.

This is acceptable given the amount of impacted users and the fact that
icons are not essential for using the main menu.

Note: The communityportal.svg icon while in the resources folder was
not referenced anywhere in the codebase so its removal is safe.
Please note the same icon in skins.minerva.mainMenu.advanced.icons which
is used for the community portal menu item.

Bug: T244444
Change-Id: I0f929f2f3b11362e02f0d02f57b90b34b5c93d24
2020-02-17 20:36:28 +00:00
jdlrobson 1213eb6ab3 Do not allow raw HTML in talk page overlay header
Bug: T243650
Change-Id: Icb844fb6476d07e7fc0e470d469f2ec3220066f4
2020-02-17 11:19:45 -08:00
Nicholas Ray 17a3c4bee0 Remove eslint "valid-jsdoc" rules/fix linting errors
Our eslintrc file extends "wikimedia/client" which already includes all
of the previously listed jsdoc rules [1]. Therefore, we were clobbering
this much more thorough list.

This commit removes this clobbering and enables a much more extensive
list of jsdoc rules. Additionally, downloadPageActions was made to
conform to the rules.

[1] 07320f16ae/common.json (L99-L137)

Bug: T239269
Change-Id: I19c09054ba0bf2746ac78befc1b44426352113ec
2020-02-07 13:59:24 -07:00
jdlrobson 1e64fc8f3d Dev: Address some FIXMEs
* Drop non-existent pointer-overlay selector
* Drop redundant icon class for arrow
* Drop unnecessary !important
* Drop transparent-shield class
* Reword an existing FIXME about a contensious decision and
add a new FIXME for moving some code to a more appropriate place.
* Move an image into a ResourceLoaderImage module (test with
`mw.notify('error', { type: 'error'} )`)

Change-Id: I6e38f07772afae6f13c4851ca17a67d52ca7d331
2020-02-03 08:43:18 +00:00
jdlrobson db29aa53bd Make MobileFrontend dependency a soft one
This extends the work in Ie29a1eb7746d56f7d8c99b74e5e3c213c30fdcf2

Bug: T171000
Change-Id: Ib125e1bdaace1893804892909c27a9f328445835
2020-01-17 14:02:23 -08:00
Nicholas Ray f38d025b38 🐛 Make Talk Page Support Sections With Any Valid Id
Clicking on any talk page section should now open it regardless of the
characters in it. This includes ascii and non-ascii characters.

There are two changes done here:

1) When a user clicks on a section, `window.location.hash` is set to the
percent encoded version of the associated id attribute of the section.
This is important because, unfortunately, different browsers can encode
characters that do not conform to RFC 3986 (illegal URI characters) [1]
differently when calling `window.location.hash` again [2] (e.g. chrome
encodes `>` as '%3E' while safari leaves it as '>').

2) Register the encoded version with OverlayManager. OverlayManager will
simply do a strict string equality check when checking if the current
path matches. Because the browser will navigate to the percent encoded
version in step one and this version does not contain any illegal URI
characters, `window.location.hash` should give back the same percent
encoded string and the paths will match across browsers.

**Why not put this logic in OverlayManager?**

Alternatively, we could make OverlayManager decode the current route's
hash fragment and make it compare that with the unencoded version of the
id similar to the work in
I9cdaf3b01c2e5fe25512b6c18dcf6787c4422abd. However, ids with the '%'
character would then pose problems (e.g. `decodeURIComponent('100%')`
throws an error). This would require extra logic in OverlayManager to
differentiate client supplied '%' characters from browser encoded ones.

Making OverlayManager responsible for normalizing hash fragments will
make it more complicated than it already is. However, making the client
only register routes in OverlayManager that conform to RFC3986 from the
start avoids all of this logic at the expense of making the client make
one call to encodeURIComponent (if necessary).

If this patch is agreed upon, then the next step would be to change the
jsdoc `add` method  in OverlayManager to be explicit that it will only
work with URIs that conform to RFC3986 and the client should percent
encode if necessary before registering.

[1] https://tools.ietf.org/html/rfc3986
[2] https://bugs.webkit.org/show_bug.cgi?id=180396 (Thanks to TheDJ for
pointing this out)

Bug: T238364
Change-Id: Idc2cfac51c40f585c5d43713d8edf848b10424fd
2020-01-16 20:48:58 +00:00
Nicholas Ray 27bc60716d Remove redundant click handling from Minerva drawers.js
MobileFrontend's Drawer component already adds a mask that covers
the whole screen intercepting any clicks to the `body` tag and as a
result handles hiding the drawer when clicked.
Therefore, this code is redundant.

Change-Id: I7cb9ee240400e5bb0f7ca8480cd5321210ed1d7d
2020-01-14 11:59:30 -08:00
Nicholas Ray fdcfcf2849 Remove amc outreach from talk page
As discussed in stand up we no longer need this feature on this page.

Bug: T242491
Change-Id: I2f3e4b4028593c908f0e01055d6fd772734581f8
2020-01-14 11:52:54 -07:00
Nicholas Ray 9c2ba25ca2 Update amc outreach code to reflect new drawer changes
The Drawer API was changed in Ib123efe6af1b167706a73c71c860c85e7f439cc5
to have clients in charge of appending drawers to the DOM.

To reflect and make AMC outreach drawer work with these changes, the
amcOutreach.js code in MF was refactored  in
I8aa3f2c1fe1f638810a20a5e77eb5f2e2f6addd1 to make the showIfEligible
method return the drawer instead of calling show on it.

This work refactors Minerva to make use of both of these changes.

Additional changes:

* Removes amcOutreach click handler for talk button. Talk button is a
tab everywhere except main page (I think) now so this code is just
confusing.

Bug: T242491
Depends-On: I8aa3f2c1fe1f638810a20a5e77eb5f2e2f6addd1
Change-Id: I01afe765cbcb5e79e419a3e42b3125f513e1f87e
2020-01-14 02:04:57 +00:00
jdlrobson 46f28730e1 Do not add the navigation-enabled class to body tag for drawers
This class is used for the main menu exclusively. Applying it
will reveal 2 transparent shields on top of each other when is
not desired

Bug: T214049
Change-Id: I8ddcc7082c3c602a78084157c2d613366a8016c7
2020-01-14 01:20:40 +00:00
Nicholas Ray c22eab914e Add minerva-animations-ready CSS class in Minerva
Per T234570, browser support for animations is solid now so we no longer
need to check for browser support.

However, due to some browsers firing css transitions on page load (see
https://bugs.chromium.org/p/chromium/issues/detail?id=332189), we still
need JS to add this wrapping class after CSS transitions are loaded to
prevent the transitions firing on page load for some components
(DropDownList and MainMenu). See MainMenu.less or DropDownList.less for
an example of how this is used.

MobileFrontend adds an animations class too rn, but that will be removed
in in I58f754740f7146f09c38220a7614285e57684924.

Bug: T234570
Change-Id: If0cf7113b40f7217a22b66a8669138466af2cf5d
2020-01-09 13:58:37 -07:00
Fomafix f482ee198e Use document.body and document.documentElement as jQuery selector
The eslint-disable directive jquery/no-global-selector is not needed
anymore.

Change-Id: Ia520232d6ae94a726b5c0768a8245ab555c79112
2020-01-06 14:33:44 +01:00
jenkins-bot acb42e4fad Merge "Simplify menu code" 2019-12-19 22:34:52 +00:00
jdlrobson 3c5edfa5cd Simplify menu code
Now the main menu is not using JavaScript we can simplify
the menu code to apply only to the Echo navigation drawer.

Bug: T225213
Change-Id: If4831fc700c7df3a2a389b5f95b6fbaea4b7d954
2019-12-19 12:14:13 -08:00
jdlrobson 48adb2c5bf CtaDrawers no longer stay behind in DOM
A new controller is added - drawers.js with methods for controlling
display and removal of drawers. The existing code in references is
moved there and extended to support scroll to hide behaviour

Console warnings will disappear with this change.

Additional changes:
* Standardise the page issues element selector - should be the container
not a link inside it (was a red link so triggering wrong behaviour)

Bug: T214045
Change-Id: Id4719b5209dd7647775e2959e46dbae0c3dde3ac
2019-12-19 19:56:02 +00:00
Jan Drewniak ec56a60694 Fix typo in class definition
Change-Id: Ide0fff7f7e53dd42d322a2ab3b06f5e9a8de8daf
2019-12-18 23:46:50 +01:00
jdlrobson 1223772ecb Remove references from the DOM on close and manage body classes
Depends-On: I960872c4f827c2b5a72f0c0d0ee0946792fb6e3b
Bug: T214045
Change-Id: Ice72f432fe2bce1246e7aea76ea23985227fab64
2019-12-13 19:44:18 +00:00
Nicholas Ray 05a073cc5c Use .html() instead of .text() when passing talk section title into Section
Bug: T240487
Change-Id: Ida471291f1698387a26736931ab17e6899e05b51
2019-12-13 19:11:03 +00:00
Piotr Miazga 99f3c97c3c Logout users via API Ajax call to prevent extra step on Special:Logout
Currently the Special:Logout page will ask "do you want to logout"
even if we pass the logout token. To avoid that first let's log out
user via API Ajax call.

Bug: T232734
Change-Id: Ia4cc4253b99254d7a893a55d9e05918c5d8c87e5
2019-11-26 14:45:21 -08:00
jdlrobson f1b9c909d7 Talk overlays should be synchronous
Talk overlays are only needed on talk pages, so we can now
unconditionally load them on talk pages and drop usage of
the ResourceLoader loading module.

When binding the section click handlers, the ids of the
associated headings are now removed to avoid ambiguity in
their behaviour.

Bug: T230695
Change-Id: I9b0ef7c5bc389209ed79761582e2f8aa3058c39d
2019-11-25 14:55:50 -08:00
Kosta Harlan e8e8c6cf80 Check if title can have talk page before accessing prefixed text
Loading Special:Homepage on mobile betalabs currently results in an error,
`TypeError: currentPage.titleObj.getTalkPage(...) is null`. The call to
canHaveTalkPage results in false because Special:Homepage is in a lower
namespace number than what canHaveTalkPage() checks for.

Before setting talkTitle, check to see if getTalkPage doesn't fail.
Theoretically we might want to wrap other usages of talkTitle to check if it's
undefined but it seems safe to leave them as is.

Bug: T239101
Change-Id: I913fc309458e014b84da054e25e636492e3ed12a
2019-11-25 19:27:00 +00:00
Jdlrobson 10defb5aa1 Merge "Do not jump to the top of the page when the reference drawer is closed" 2019-11-05 19:57:04 +00:00
jenkins-bot 84bc822a4c Merge "Make label for the PDF button in the page-actions menu appear on desktop size" 2019-11-05 19:05:24 +00:00
Jan Drewniak 96ced4d6e3 Make label for the PDF button in the page-actions menu appear on desktop size
Bug: T226562
Change-Id: I60b0f2030b2519a36a2c5bbdc256885980de6420
2019-11-05 19:52:01 +01:00
jdlrobson b4f03d475f Do not jump to the top of the page when the reference drawer is closed
The default behaviour is only needed for the main menu and notification
drawer. In the case of a references drawer where no URL navigation has
occurred, do not reset the hash.

history.replaceState cannot be used here as that interferes with the
OverlayManager's work.

Bug: T237015
Change-Id: I51b8c755933f33a3274aa77dc4e4c0b929d872ec
2019-11-05 17:58:00 +00:00
Nicholas Ray 3a6729841b Remove eventbus usage in talk.js
Now that we have refactored TalkSectionAddOverlay to not use the
eventbus and instead exclusively use the passed in onSaveComplete
callback in I75158ff363d56d55ae385687baf64f8b9d5ca8b0, we can remove the
references in talk.js.

Bug: T230695
Depends-On: I75158ff363d56d55ae385687baf64f8b9d5ca8b0
Change-Id: Ia874fa04c125b00fd1997aa4be8b781d76a18763
2019-11-05 09:51:43 -07:00
Nicholas Ray 2d579183c9 Render talk page as a tab instead of an overlay
Following up on Jon's POC, this will get rid of the talk board component in
favor of linking to the server rendered talk page.

Additional Changes:

* Cleaned up talk selenium tests. Removed talk_steps.rb which doesn't appear
to be used anymore.

* Changed talk add button classes to a single class

* Moved "Add discussion" button to postheadinghtml per design mock

* Added  "...talk-explained", "...talk-explained-empty" messages to
postheadinghtml per design mock

* Due to undesirable jumps in window scroll caused by the section anchor
& Toggler.js code when opening the TalkSectionOverlay (read fixme in
code), a Promise is always returned from OverlayManager route to reset
the scroll position to the top when the section overlay is opened.

* Moved
"mobile-frontend-talk-fullpage",
"mobile-frontend-talk-reply-success",
"mobile-frontend-talk-topic-feedback",
"mobile-frontend-talk-explained"
"mobile-frontend-talk-explained-empty"
messages to minerva as minerva is
the one who initiates those messages now.

* Limited $talk selector to only `.talk` elements since amc talk tab
does not need to be targeted

* After saving a reply from TalkSectionOverlay, the DOM that is not
part of the overlay becomes out of sync since a new reply was created.
To get around this, an `onSaveComplete` callback was passed (similar to
the TalkSectionAddOverlay) to execute a full page refresh. Although this
is clunky, it is the easiest way to resync.

Bug: T230695
Depends-On: I80201394fd7015db6700446142b0b4b20829f12e
Change-Id: I243f1193bce0da9fa710fc3b5379f90b2d079680
2019-11-05 09:51:43 -07:00
Ed Sanders 49dd1fd71a build: Update eslint-config-wikimedia
Change-Id: Ic2148121161b804c3f6f41b9446fcea066f3de0d
2019-10-31 23:08:57 +00:00
jdlrobson 7f68c3d3ad MainMenu is a controller not a View and server rendered (take 2)
There should be no caching implications for this change, as the main menu
has been server side rendered on all wikis since 10th October.

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.

ev.preventDefault in onSkinClick is dropped since the link to the '#'
(the default behaviour) is wanted

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

Bug: T234650
Change-Id: If101eebbdbda1519af922745917237648722820e
2019-10-29 16:37:04 -07:00
jdlrobson bfc7540f7f Menu groups have identifiers
For compatibility and consistency/convergence with Vector, Minerva's
menus are linked to their Vector counterparts.

This allows us to get mw.util.addPortletLink to work inside Minerva

Bug: T231925
Change-Id: I121f12497eac6fcf0b63b9ccce561320eb8b3e62
2019-10-25 19:00:54 +00:00
Volker E 19b1ea2297 Unify transition values across board
Using newly introduced variables instead of fixed values.
Also adding `transition` to property blacklist to ensure using
mediawiki.mixin.

Bug: T236224
Change-Id: I3d2d05f4e50e7b6bba0fe84fae1dde5de5b75492
2019-10-24 12:11:52 -07:00
jenkins-bot 0c3f7bc52d Merge "Use core watchstar code" 2019-10-15 22:56:25 +00:00
jdlrobson bf8d325388 Use core watchstar code
Apply the mediawiki core watchstar to the
Minerva skin. Note, watchstars in search and other locations will
continue to be provided by the MobileFrontend library (see
follow up patch I7b748dc87089389400b0035c62a3b9a00c2e43f9)

Bug: T234970
Change-Id: I11bbe976412b50dba76a55f37887e4c9235d0be1
2019-10-15 15:33:25 -07:00
jenkins-bot 43b6c80461 Merge "Hardcode page issues vertically alignment" 2019-10-14 14:46:23 +00:00
jdlrobson ab61dbb173 Echo is removed from Minerva
Managing the transition from old implementation to new:
* A version number is exported from skins.minerva.scripts to
tell dormant code added to Echo in I09c27a084100b223662f84de6cbe01bebe1fe774
to begin running.
* A skinStyle is added for the new `ext.echo.mobile` module.
`mobile.notifications.overlay` will soon cease to exist but is kept registered for
backwards compatibility reasons
- Drop ev.preventDefault call from onSkinClick - it is no longer necessary and will ensure
notifications overlay closes when shield is clicked while it is open.

Integration:
* A server side hook SkinMinervaReplaceNotificationsBadge allows Echo to replace
the current Minerva notification badge
* A to-be-created client side hook is subscribed to to deal with the navigations drawer
like functionality using the mainMenu code
* id and class names are added to the container for the NotificationBadge for compatibility with
ext.echo.init in Minerva's desktop mode (it will work like Vector)

See I09c27a084100b223662f84de6cbe01bebe1fe774 for understanding the bigger
picture.

Depends-On:  I09c27a084100b223662f84de6cbe01bebe1fe774
Bug: T221007
Change-Id: I4c11f1b241d629e1b294ebaec17472fbf944f8c7
2019-10-08 23:21:12 +00:00
jdlrobson a66f3a3cec Hardcode page issues vertically alignment
Bug: T234254
Change-Id: If14e52558631a20ea444564fa4758e20cf8ccf42
2019-10-08 20:41:31 +00:00
jdlrobson e72c0d7ba4 Render main menu and shield on server side
This is a second attempt at I3892afb5ed3df628e2845043cf3bbc22a9928921
that is cached HTML friendly and won't cause T234599.

This time rather than solving the entire problem, we'll start rendering
the menu on the server, to allow us in future to drop the Menu code

Bug: T234650
Change-Id: Iea5406ef1c561f2907ec6132481007673aabf1e9
2019-10-04 19:35:28 +00:00
jenkins-bot 18b483b6ea Merge "Revert "MainMenu is a controller not a View and server rendered"" 2019-10-04 15:18:11 +00:00
Jdlrobson 93b16db1c5 Revert "MainMenu is a controller not a View and server rendered"
This reverts commit 111757970e.

Although I cannot replicate the performance issue, the menu doesn't seem to be rendering at all on cached HTML so this is a deal breaker. Back to the drawing board..

Bug: T234599
Change-Id: Idadc5a079340f44ec66d20a38259b6b337d2dcee
2019-10-04 15:03:19 +00:00
jenkins-bot 3c6fd24f00 Merge "MainMenu is a controller not a View and server rendered" 2019-10-03 20:30:02 +00:00
jdlrobson 111757970e MainMenu is a controller not a View and server rendered
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
2019-10-03 13:13:09 -07:00
jenkins-bot b962edb559 Merge "Remove wgMinervaErrorLogSamplingRate" 2019-10-03 15:26:51 +00:00
jdlrobson 8ee17cf2b0 Remove wgMinervaErrorLogSamplingRate
We are counting errors rather than sending them via EventLogging.
This code is thus being shipped unnecessarily to our users and is
not ever enabled in production

Given our work to use Sentry (T106915) let's remove this code.

Bug: T233663
Change-Id: I71ef7377e91e38f9ccc13493d52ab629d433f8f4
2019-10-03 14:57:14 +00:00
Nicholas Ray 33236091f2 Trigger AmcOutreach on History, Talk, and Desktop links
This follows up on the work from MF:
- I399dd70b5b93fda8c6d1735e3861c5ab2da43bdb
- Id59381ddc330de2b8017963d6a25c6567317faf7

Event handlers are added to the history link, talk link, and desktop
link to support amc outreach. When eligible, the drawer is shown. When
ineligible, logic from the regular handler is executed.

Bug: T226069
Depends-On: Id59381ddc330de2b8017963d6a25c6567317faf7
Change-Id: I0cce0bb6f44801c383556f8c26ee865032d86c8a
2019-10-02 14:55:18 -06:00
jenkins-bot 27f9422613 Merge "Curtail use of mw.mobileFrontend in Minerva" 2019-10-02 00:10:40 +00:00
jdlrobson 81bbd6eb48 Use consistent small font sizes
* Add @font-size-minerva-smallest and use it in place
of font-size: 0.8em across the site so that we get a round
number for our font sizes.

Bug: T229568
Change-Id: I4270225c07941b4c164d5e044f70d4b131dbc19d
2019-10-01 22:29:55 +00:00
jdlrobson ef5003f310 Curtail use of mw.mobileFrontend in Minerva
The MobileFrontend dependency in Minerva is problematic.
Code that Minerva needs should live in core.
MobileFrontend should load code on all skins when they operate on
a mobile domain.
This eslint check reminds developers of this in a hope it encourages
more upstreaming to core when possible.
Of course disabling is also an option, but this check will at least
make us aware of when we are moving further away from the goal.

Change-Id: I62183c9aefc81053e4ad81fb746decef2dd24b44
2019-10-01 14:54:59 +00:00
Jan Drewniak 51049c0ceb Refactor "last-modified" bar to use flexbox layout.
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
2019-09-27 00:03:14 +00:00
jdlrobson e888b487f4 Merge skins.minerva.talk and skins.minerva.watchstar into skins.minerva.script
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
2019-09-24 14:19:18 -06:00
Ed Sanders 8e579c373b build: Update linters
Change-Id: Ie0983466ad0eed0a30d62f28b10efebd0f2eacba
2019-09-17 14:21:30 +01:00
Jan Drewniak 73e87fdc08 Align right-most header icon with content.
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
2019-09-16 11:05:36 +02:00
Jdlrobson 9ec7217d47 Merge "Adjust notification icon to be the same size as the other icons" 2019-09-13 21:53:37 +00:00
jdlrobson 109b24e0ee Adjust notification icon to be the same size as the other icons
Bug: T232011
Change-Id: I0300685d38551bc9ee2c2bd32d6348f32d4df4de
2019-09-13 13:55:01 -07:00
Jan Drewniak 35e489de25 Fix truncated text showing through icons & last-modified bar
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
2019-09-13 18:35:31 +00:00
Jan Drewniak 2ef6119bed [ICONS] Fix icon positions in page-issues, inline and overlay
Bug: T232837
Change-Id: Ie24b38146b9361f86467d40db7b07b6a5d0655d1
2019-09-13 15:47:50 +02:00
Jan Drewniak be76f05ebb Prepare for new mw-ui-icon spec for Minerva
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
2019-09-12 18:44:44 +00:00
jdlrobson c0f08790ea Remove the mw-ui-icon hacks and overrides
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
2019-09-10 10:53:20 -07:00
jenkins-bot 53ad4bac32 Merge "New table of contents icon, prepare for arrow->expand rename" 2019-09-09 19:25:29 +00:00
Timo Tijhof 6e4afbf3bb mediawiki.RegExp (deprecated) -> mediawiki.util
Bug: T218339
Change-Id: I6913330609c03a0418af2ab54aa31f27a52dc6d0
2019-09-09 18:10:35 +00:00
jdlrobson fea60ba244 New table of contents icon, prepare for arrow->expand rename
Bug: T231613
Change-Id: I86a4bdac83e1d6caef025ad025962127d74556dd
2019-09-09 10:39:52 -07:00
Nicholas Ray f7baa81b17 Remove skins.minerva.scripts/overlayManager.js
Instead, I think we can just use:

```
M.require( 'mobile.startup').OverlayManager.getSingleton()
```

Change-Id: I3c1d5d8ffb95eea7cf076c86e8e9578aff7f95a8
2019-09-06 14:32:01 -06:00
jdlrobson 96cee263fb Dev: Access OverlayManager via singleton method not M.define
Change-Id: Icb152f21bfd3a091676980a025dc651e49f49312
2019-09-06 19:30:22 +00:00
Volker E 1f27981ed1 Consistently use .transform() mixin
Make use of mediawiki.mixins' `.transform()` mixin for widest available
browser support.
Follow-up to I720e62a578f0c7a14f4b5a698004471c85e54bc8

Change-Id: I771a5a6e2020e323bf4cefdb944c26bdcce26ee2
2019-09-03 15:33:10 -07:00
jdlrobson 15323b3d63 Use core table of contents in Minerva
No more using the TableOfContents component in MobileFrontend. It's
just creating more work for us. The end result is exactly the same - we can make
a table of contents using the checkbox hack rule and CSS that looks identical to
the current table of contents.

For now, this change can only be tested on Minerva desktop.
I2ea1c23bc86871e2a095c4c6674a08ff2f04b160
is the patch that goes for the jugular and applies this to mobile Minerva. It's
important we merge the two together to avoid disruption to this feature, as
currently MobileFrontend strips the table of contents from core from the HTML
using the MobileFormatter.

Change-Id: I720e62a578f0c7a14f4b5a698004471c85e54bc8
2019-09-03 19:02:31 +00:00
Stephen Niedzielski 936ec8dcb4 [LESS] remove unused variables
Identified by:

  find -type f -name \*.less|
  xargs -rd\\n sed -rn 's%^\s*(@[a-zA-Z0-9_]+):.*%\1%p'|
  xargs -rd\\n -I{} bash -c "rg '{}''[^:]' > /dev/null || echo '{}'"

Change-Id: I64e02731e9f8b69ce8e934502208c061d595b673
2019-08-29 16:35:00 +02:00
jenkins-bot 505a191755 Merge "Avoid unnecessary stopPropagation usage so event click tracking can work" 2019-08-27 10:01:44 +00:00
jdlrobson 44954fe3fd Avoid unnecessary stopPropagation usage so event click tracking can work
Hamburger menu item - stopPropagation and associated comment seem
unnecessary.  Clicking page center is supposed to hide open menus!

Notification item - also unnecessary and outdated comment. Works as
expected without

Talk links - no reason to stopProgation (which happens when you return
false) - only event.preventDefault is needed.

Edit icon - see depends on

Depends-On: Ie23ae7d8dba31b5f524693e60580032e2ccd714f
Bug: T220016
Change-Id: Ica95076f4399d173d49087e5c866f55fe6aec597
2019-08-26 11:43:11 -07:00
jenkins-bot c543219d3a Merge "Dev: Prep for storybook" 2019-08-21 21:08:25 +00:00
jdlrobson 7280d255c0 Dev: Prep for storybook
* Remove ambiguity in imports - say the file extension
'less' for all instances of variables and mixins.
* Separate toast styles from drawer styles so they can be
imported separately
* associate header-action selector with its parent
(.overlay-header) not parent's parent (.overlay) so it can be imported
and rendered without the Overlay.

Change-Id: Ib7e19a440ba095d6424d35305fb41d643ca9764c
2019-08-21 12:20:26 -07:00
jdlrobson ab8da137cb Provide access to original redirect page on toasts
Color progressive/destructive (blue and red) do not make
sense on a black background, so we use white and underlined
for both of these. Note these don't seem to be used currently
so this is not a breaking change.

Bug: T150189
Change-Id: I78a92b5b6c76638633b99fe32670911d355ce6f3
2019-08-12 22:48:14 +00:00
jdlrobson 59fe37cde1 Use showReference function rather than deprecated ReferenceDrawer
Bug: T217295
Depends-On: I2ef762dbc1458411dd8ed746b7e829a2924740e3
Change-Id: Ia90ba47f152315fd39da368edac986b55f8bd5a0
2019-08-12 18:58:25 +00:00
Niedzielski 6241c8dad7 Revert "MainMenu no longer manages classes on the body tag"
This reverts commit 354de09fa7.

When tapping notifications, both main and notification
menus are shown.

Change-Id: Iaa3ca4d2c7eadb1c9888b514d08895c658336d10
2019-08-07 23:43:43 +00:00
jdlrobson 354de09fa7 MainMenu no longer manages classes on the body tag
The responsibilities of managing the classes on the body tag are
pulled upwards from the Menu code.

Due to the absence of global state/Redux like thing, the open and close
navigation drawer methods remain for the time being.

Bug: T206354
Change-Id: I77cd8ff75b0d4487ad19c1506a2911791542d70f
2019-08-07 20:11:09 +00:00
Jdlrobson 8d703b7758 Remove all main_menu tracking related code.""
This reverts commit de353c06c9.

Bug: T228681
Change-Id: Idfd964c31e09e271dca9ac39f7932df49cdcb5f6
2019-08-01 10:40:09 -07:00
jdlrobson a0e5139e40 Don't show download button on missing pages
Additional: Pass in a page rather than a skin - skin is not
used anywhere other than to get the page

Bug: T211775
Change-Id: Ia7c56158773ac16992fb1ebf002131e9c24dda14
2019-08-01 16:11:57 +00:00
Stephen Niedzielski 93f930ce3e [UI] [menu] remove menu height resizing
Remove the page action overflow and user menu height sizing. Previously,
a maximum menu height was set so that the menu itself would scroll. A
minimum height was also used so that the menu couldn't be shrunk down to
a silly size. Both the minimum height LESS and maximum height JS are now
removed.

Bug: T225959
Change-Id: I201374ab8b249272ee5dbb1401b844ffe034ea66
2019-07-31 20:05:54 +00:00
Roan Kattouw ec17da76c1 Improve tab scrolling logic
* If the leftmost tab is selected, scroll all the way to the left
* If the rightmost tab is selected, scroll all the way to the right
* If a tab in the middle is selected, scroll to center it
* If the selected tab is wider than the tab container, make sure its
  start (left edge in LTR, right edge in RTL) is always made visible.

As Bartosz reminded me, .scrollLeft in RTL is a cross-browser nightmare
(see https://github.com/othree/jquery.rtl-scroll-type), so add a bunch
of code working around this. Some of this logic is in OOUI already, but
what's there is not enough for what we need here, and we also don't want
to load OOUI for this.

Bug: T223142
Change-Id: Ica298954b42f9daa4819043ec24bc0266290a927
2019-07-30 18:35:14 -07:00
jdlrobson dfb3e0b8c7 Restore MobileWebMainMenuClickTracking logging (old way)
menu/schema is never imported so it never executed.
Move it into initLogging which seems to the be the logic place
for this code to execute

Change-Id: Iec85548cf96fcc7ea96977d0aa89f601dbd8599f
2019-07-30 15:41:35 -07:00
jdlrobson 0443f9936f Dev: Simplify red link drawer
* Remove event and add class .hide so that it uses event defined in
Drawer class
* Use actionAnchor - it achieves the same purpose

Change-Id: I2570de1e692a22c9383a850460eabb75b3d8eaf5
2019-07-30 08:29:29 -07:00
jdlrobson afecb58a88 Restore desktop MMV
Changes in the MultimediaViewer extension mean Minerva's onClick event
is preventing the default of the click handler in MultimediaViewer.

Explicitly do not setup our multimedia viewer version when the desktop
MMV is present!

Bug: T227034
Change-Id: I94e22d045346d53bb2c50035281398799fb6c7ac
2019-07-29 23:36:16 +00:00
jenkins-bot e9a879e635 Merge "Drop lazy loading references feature usage" 2019-07-26 19:58:47 +00:00
jdlrobson d1cd558821 Drop lazy loading references feature usage
This temporarily and quietly breaks references display in beta
on the assumption
that I2dcf9b0cbfe2f46eb6763e0add4ed892d1fbecd9 will be merged swiftly
afterwards.

Bug: T123328
Change-Id: I2dcf9b0cbfe2f46eb6763e0add4ed892d1fbecd9
2019-07-26 19:04:46 +00:00
jdlrobson f0503a52d0 Refresh the user, bell and search icon
* 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
2019-07-25 16:35:01 +00:00
jenkins-bot 84b950da58 Merge "[UI] [new] add user menu" 2019-07-24 18:41:46 +00:00
Stephen Niedzielski 0a4f5b6126 [UI] [new] add user menu
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
2019-07-24 18:24:07 +00:00
jdlrobson 0c5ca96031 Drop mobile.init dependency
Depends-On: If0de2d74139131be592d8edc2dbf063e9b98860c
Bug: T216537
Change-Id: I4b8011f5b73000a01d9cea032a6287b24b10f6ec
2019-07-24 15:28:49 +00:00
Pmiazga de353c06c9 Revert "Remove all main_menu tracking related code."
This reverts commit d11c84d08b.

We decided to track both old MobileWebMainMenuClickTracking and new MobileWebUIActionsTracking for some time. Then once everything goes stable and it's proven to work correctly we will merge d11c84d08b.

Bug: T220016
Change-Id: Ib4d52e8b8c870774041284e575564a9933af6136
2019-07-22 18:31:55 +00:00
jenkins-bot 9352a70023 Merge "Remove all main_menu tracking related code." 2019-07-19 16:24:49 +00:00
Piotr Miazga d11c84d08b Remove all main_menu tracking related code.
This code should live in WikimediaEvents extension, not in
Minerva.

Bug: T220016
Depends-On: Ic2d6d1b21b0eb72ad68b0c447bc63f7d1bb021f4
Change-Id: Iaeb12704dcd257f0783f1ebec3def01cb2848228
2019-07-19 15:30:28 +00:00
jdlrobson 0a4f88b317 router.navigate is deprecated use router.navigateTo
The navigate method does not accept a second parameter for
replacing state. navigateTo was what was wanted.

Mark navigate as deprecated (to match ooui router) to make
sure this doesn't happen again.

Bug: T226106
Change-Id: Ie86fa632b2175727417b166c222c29bdf12bfea4
2019-07-16 16:50:58 -07:00
jdlrobson a9d73060fa Restore table of contents and error logging
When moving to packageFiles, the modules errorLogging and toc
were not imported by init.js meaning they were not run.

ResourceLoader should probably error in this situation, but until
then we should fix this problem.

This is a follow up to I44790dd3fc6fe42bb502d79c39c4081c223bf2b1

Bug: T212944
Change-Id: I86efb7be1c39b03f63c8f1e0b107216cd30ff6de
2019-07-16 14:45:35 -07:00
jenkins-bot 6076c61772 Merge "Embrace packageFiles" 2019-07-16 21:21:42 +00:00
jdlrobson 72df451bd3 Embrace packageFiles
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
2019-07-16 18:04:10 +00:00
Stephen Niedzielski 21b24830b5 [dev] match page issues LESS filename to JS naming
Bug: T212944
Change-Id: I0fa44cdb26b24fff87a7c4dfd424fe4400ceee22
2019-07-16 18:03:44 +00:00
jenkins-bot 4e2458aeba Merge "Make Minerva use new PageHTMLParser.js and refactored Page.js" 2019-07-15 23:12:58 +00:00
Nicholas Ray 331df226f5 Make Minerva use new PageHTMLParser.js and refactored Page.js
In I02f8645aac1d7b081eaba8f2ac92a2ef51f78182, Page.js was made into a
model and its html parsing responsibilities were moved to
PageHTMLParser. Additionally, a singleton for the current page
(currentPage.js) and a singleton for the curent page html parser
(currentPageHTMLParser.js) were introduced to replace the usage of
M.getCurrentPage().

This commit refactors Minerva to make use of these changes.

Notable changes:

* 🐛 The event bus singleton was added to references.js since it
previously relied on an instance of Skin to listen for the
`references-loaded` event. However, this event is emitted on the event
bus singleton.

* Additionally, I didn't see a reason why the `references-loaded` event
needed to also pass the current page instance when the only file
listening to it is references.js (which already has the current page
instance) so I removed that and the convoluted passing of page.js within
the file. I assumed this logic was unecessary.

* The call to drawer.showReferences in references.js now was made to
pass the currentPage instance as well as the currentPageHTMLParser. This
is to prepare for I6e858bbe73f83166476b5b2c0fdac1cca7404246 where the
getReferences() interface for ReferencesMobileViewGateway.js and
ReferencesHtmlScraperGateway.js is refactored to accept both of these
instances. Additionally, references.js was refactored to support event
delegation which gets rid of some parsing/setup logic.

Bug: T193077
Depends-On: I02f8645aac1d7b081eaba8f2ac92a2ef51f78182
Change-Id: I2f32dbcc4ebaa4bebb297cda1ecce3457922b343
2019-07-15 16:43:51 -06:00
jdlrobson 6df395f141 Guard against undefined config variable
Bug: T225423
Change-Id: Icfbd90c52d9f27ee58bde15c010f705b081285ab
2019-07-12 13:06:52 -07:00
jdlrobson 9b4c22f31f Update page issues folder structure
Tests are untouched as these will be moved to headless
node-qunit in a follow up.

Bug: T212944
Change-Id: I3d9b43387e34fd49827e3ab62420f3555ff4b3cd
2019-07-08 23:07:28 +00:00
Stephen Niedzielski edb4385345 Hygiene: extract ToggleList to a reusable component
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
2019-07-04 13:48:13 -06:00
Roan Kattouw b64b4c1b9f Don't scroll vertically when scrolling active tab into view
Do the scrolling math manually, and only do horizontal scrolling on the
tab container. Don't do vertical scrolling, and don't scroll the
viewport.

Bug: T226112
Bug: T223142
Change-Id: Ie67e15bd51252906897a213505ae82cf29ba5cf2
2019-06-24 15:18:56 -07:00
Stephane Bisson 4f5dbf7d55 Make the tabs scrollable horizontally
* Add a container around the tabs and use flexbox
  to position the tabs on one line and make it
  scrollable.
* Add some JS to scroll the currently selected
  tab into view.

Bug: T223142
Change-Id: Ie2205e6836797c2ac000e12a01f78a4aa7bc5b81
2019-06-14 13:50:23 -04:00
Ed Sanders 12e6a2b9d5 Add missing dollar prefix to jQuery variable
Change-Id: Ib6ea281b749e040d43c2dc3558a0a96ce59b7385
2019-06-12 21:29:49 +01:00
Timo Tijhof 9ef2e2e88f skins.minerva.scripts: Remove use of deprecated ext.eventLogging.subscriber
Was trimmed down and merged into 'ext.eventLogging'.

Bug: T221281
Change-Id: Idd03f92950a05bef31b7ad843600504281ec39f2
2019-05-22 20:03:56 +01:00
Ed Sanders 8e352f7824 Connect initMediaViewer to wikipage.content hook
This means if new content is added to the page, it
will be connected to the media viewer code.

Depends-On: I79caa6d1b83ec2a618ca703607165197add4e100
Change-Id: I9936ee1decaa5de6677bc33ebe726ff6253d6ac5
2019-05-08 18:41:22 +00:00
jenkins-bot dcf2d589a3 Merge "Minerva is Hogan free" 2019-05-01 19:41:39 +00:00
jenkins-bot db3e6d2380 Merge "Do not use pass the "string" (deprecated parameter) to toast show method" 2019-05-01 18:25:15 +00:00
jdlrobson 281341f0b4 Do not use pass the "string" (deprecated parameter) to toast show method
Bug: T217220
Change-Id: Ie188a0e613d16775c327dadf505cf8a10005d450
2019-05-01 17:15:32 +00:00
Nicholas Ray 858935210b Hygiene: Cleanup schemaMobileWebMainMenuClickTracking sampling rate logic
AMC mode is already determined prior to the `trackSubscribe` callback
executing so we can set the sampling rate outside
the callback as well.

Hopefully, this improves readability. If not, I'm happy to abandon this
patch.

Change-Id: Ic1386c0e31ae7fbdd52f18d3b881ec6a5fb5a67c
2019-04-26 11:13:35 -06:00
jdlrobson daef425ba1 Minerva is Hogan free
All hail Mustache!

Change-Id: Iaf83dc27addd00ffd65d003bd5d84441965124e8
Depends-On: If00010e092e3766f9812f9a69ce0dfe22298689a
Bug: T220620
2019-04-25 10:34:01 +08:00
Stephen Niedzielski 815f3386e3 Update: add secondary page actions submenu in AMC mode
When advanced mobile contributions mode is enabled and
`$wgMinervaOverflowInPageActions` is set, show a secondary overflow menu
on main namespace articles and user namespace pages. The menu content
varies for each namespace. The new submenu is *disabled* by default,
even when AMC is active. This feature should not be deployed until
instrumentation is available.

The secondary menu is rendered in PHP using the existing menu system
with some changes to the template. The checkbox hack is needed for no-
JavaScript keyboard navigation until :focus-within is supported. CSS
additions are documented in the source.

All client side toolbar execution occurs in Toolbar.js. Enhancements are
documented in the source.

Minor changes to the existing download button:
- Move download and edit button initialization to Toolbar.
- Update copy (not visible) from "Download" to "Download PDF".
- When the overflow menu is present, use the "hasText" / label style.

Wikimedia UI icons are copied from OOUI at d00a0ac and seem useful to
expose as HTTP URIs (not data URIs).

The overflow menu does not show for pages provided by the content proxy
since its entries depend on $tpl->data['nav_urls'] being populated.

Bug: T216418
Depends-On: I0781151a8232b6a7b52f79a34298afcecb8e4271
Change-Id: I4b50a0e519024a7ab91dae6ab40b23cf14a03861
2019-04-19 14:51:17 +00:00
Stephen Niedzielski cbea4fabd5 Hygiene: remove unused downloadPageAction argument
Remove unused Skin parameter from downloadPageAction.

Change-Id: I27cd85b1e4f2328d3d4fd0ece5580c4432181757
2019-04-10 15:21:27 -06:00
Jan Drewniak 7821b1499c Removing code related to old page-action menu markup
Bug: T218653
Change-Id: Ifafe86f36be59fc22bb02c42b3ff12509c67b53d
2019-04-10 22:31:14 +02:00
James D. Forrester 75a751f1c6 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I36a88cbf8b468646c21d47c3b58433895e8ff31a
2019-04-04 18:01:40 +00:00
Nicholas Ray 517e4f537a Add amc boolean to MobileWebMainMenuClickTracking sampling
Now that we can determine client side whether or not a user is in AMC
mode from Ie000fc8f938a76d10c2566f17f933cef40aa1665, let's add this data
to MobileWebMainMenuClickTracking sampling. Per T218627, if the user has
amc enabled, the sampling rate will be 100%. If not, the sampling rate
will follow wgMinervaSchemaMainMenuClickTrackingSampleRate.

Additional changes:

* Removes an outdated comment at top of schema.js (this has already been
moved)

* Corrects jsdoc comment for defaults.mode

* Updates EventLoggingSchemas entry for MobileWebMainMenuClickTracking
in skin.json to accommodate new amc field.

Depends-On: Ie000fc8f938a76d10c2566f17f933cef40aa1665
Bug: T218627
Change-Id: I950a6efd1040c3a270d09bff298ee1781a010328
2019-04-01 17:39:16 -06:00
Nicholas Ray 799f426f5b Make minerva use updated mediaViewerOverlay factory function
Additional changes:

* rlModuleLoader is no longer needed now that the mediaViewerOverlay is
part of mobile.startup so that was removed in addition to the calls to
it.

* Removed the EVENT_SLIDE/EVENT_EXIT logic as the mediaViewerOverlay
now handles its own slide/exit behavior

Bug: T216198
Depends-On: I36e3c0645c931492fbef0b7c0a49f6a418dbd3a1
Change-Id: I04656c4adb7edc9a111447de3d63044044a8d6dd
2019-03-25 14:18:16 -06:00
Jan Drewniak 6d34e401ff Remove skins.minerva.icons.images.variants module
This module produces 6 icons:

["clock", "profile"] * ["black", "gray", "white"]

of which only 3 are needed: clock-gray, clock-white, profile-gray.

This patch removes the module and moves the "clock" and "profile"
icons into `skins.minerva.icons.images`. Since that module
does not inline SVG's, the additional cost of adding these icons,
which are loaded at startup, is minimal.

The editLocked.svg icon has also been edited to correct its color.

Bug: T218807
Change-Id: Ib54960eb556dfe0c1ae06d2f73d4f350e519e20f
2019-03-22 09:46:14 -07:00
Stephen Niedzielski 88dd2530e7 Update: don't prompt to create User pages
Suppress the redlink drawer for User namespace pages. The redlink drawer
prompts the user to create a missing page but this hinders the usual
workflow for User page visits specifically. A User page is connection to
an account's contributions, age, and other activities and encouraging
the creation of a missing User page when trying to view these
connections is a hindrance, especially if the missing User page is not
associated with the current user.

Bug: T201339
Change-Id: I784493a8ecf28176b5a393cb52d7bfa9fa9b1309
2019-03-19 18:07:32 +00:00
Jan Drewniak 38178c608a Passing page parameter to TOC toggler
The `page` parameter for the table of contents widget was null,
causing an exception to be thrown when the Toggler checks for
page.title.

Bug: T217820
Change-Id: Ifb78496c8b42f9500ab03655a496e9aae6d1c04b
2019-03-07 11:03:28 +01:00
Jan Drewniak 864a1766a7 Refactor pageActions menu to accommodate AMC mode
This patch refactors the markup and JS associated with the page actions
menu in order to achieve greater flexibility in its presentation.
The menu items are now positioned via flexbox and rendered using a mustache
template in PHP.

The goal of this refactor is to accommodate both AMC mode and default
mode with the same markup. No changes should be visible for non-AMC
users with this refactor. No changes to AMC mode have been made in this
patch either.

This patch includes temporary workarounds to avoid problems caused by HTML caching.

Changes include:
- Changing the data structure of the page_actions property in SkinMinerva.php
- Passing that modified data structure into a new mustache template, PageActionMenu.mustache
- Adding new CSS for the new page actions menu HTML
- changing the query selectors in JS to match the new markup
- Making the JS-modified page-actions compatible with the new markup
- Keeping existing CSS and JS to avoid breaking cached HTML

Bug: T213352
Depends-On: I95cf726c4b6d8c3895a26aa6e07f4b1747ee30fe
Change-Id: I5a7d73b20617cb3c6d6379084ac4bea23ec3bc74
2019-02-28 12:31:57 +01:00
jdlrobson 52918caff9 Allow us to distinguish errors for logged in users
Logged in users may be more likely to have client side errors - either
through using interfaces that require authentication or through gadgets
that they run. I'd like to separate the two.

Bucketing like this means we can still continue to count all client
side errors, but we can have additional graph lines for logged in.
This way we can notice spikes in bugs limited to logged in users
for example T216853

Change-Id: I965c45f8b548abb16b400571ddf7852ca088529b
2019-02-26 18:03:39 +00:00
Nicholas Ray 7cfcb3641b Refactor LanguageOverlay styles
In I629245100f4ca430a88e450939b90d075e7021f1, languageOverlay styles and
LanguageSearcher styles were split into two different files. This commit
mimics that change in skinStyles. All languageOverlay specific styles
were moved to languageOverlay.less, while all LanguageSearcher styles
were moved to LanguageSearcher.less.

Other chagnes:

* Changed a reference in init.js

Bug: T215657
Change-Id: I395a61cd6051ad5c6b6601205f112b55f5ab8273
2019-02-22 11:02:30 -07:00
Nicholas Ray a48df04a75 Call new language factory instead of LanguageOverlay
When merged with I629245100f4ca430a88e450939b90d075e7021f1, the need to
use rlModuleLoader.js (white screen loader) with LanguageOverlay is
eliminated. When calling the language factory function, an Overlay is
now synchronously returned with a spinner shown in its content area
while the lazy load request + xhr request are executing. PromisedView
will replace this spinner with the LanguageSearcher component when the
promise resolves (rejects continue to be unhandled).

* The getDeviceLanguage function was moved into languageFactory.js
inside MobileFrontend

* the lazy load code and gateway.getPageLanguages code was also moved
into languageFactory.

Bug: T215657
Depends-On: I629245100f4ca430a88e450939b90d075e7021f1
Change-Id: Ie6dad4bd3c80e6cfcc1d7f9ad38941a323ba3cc6
2019-02-21 12:15:55 -08:00
Ed Sanders eeebb86270 Avoid deprecated View.$
Replace with View.$el.find.

Bug: T216264
Change-Id: I78045c410c168bf458ab8f5537036711fc5b577c
2019-02-15 19:04:11 +00:00
Stephen Niedzielski 7d4ca12a2e Hygiene: remove unused page issues function
Remove getAllIssuesSections(). This is no longer in use and does not
appear to be sufficiently general purpose to want to maintain.

Bug: T212371
Change-Id: I7ed73408705cba64b26dd318e78ae415b707e687
2019-02-13 01:34:32 +00:00
Stephen Niedzielski f54b4e75db Hygiene: move variable from file to local scope
Move allIssues from file scope to local scope.

Bug: T212371
Change-Id: I74693925ff0b20a36ec6acd53490cfde7273c984
2019-02-13 01:33:04 +00:00
Stephen Niedzielski 8ee27ed610 Hygiene: favor page issues all sections symbol
In pageIssues.js:

- Consistently use the KEYWORD_ALL_SECTIONS symbol instead of hardcoding
  the string, "all".

- Improve typing for allIssues.

- Wrap a long line.

Bug: T212371
Change-Id: I429fe37f88311c787e91946bb1438c6961eeeb5b
2019-02-13 01:32:29 +00:00
Stephen Niedzielski 3dc9cff2c2 Hygiene: separate page issue view logic
- Move page issue view components that do not modify the DOM during
  during construction to PageIssueLearnMoreLink.js and PageIssueLink.js.
  PascalCase is used optimistically for filenaming in the hopes that
  these functions can become something like a JSX component. A "new"
  function prefix is used in the meantime.

- Move page issue view logic that munges the existing DOM to
  pageIssueFormatter.js. Substitute "create" prefixes for insert so that
  clients won't forget that calling the function is a modify operation.
  Alternative naming welcome but it shouldn't be confused with more
  idealistic components that do not depend on DOM state for
  construction.

- Consolidate createPageIssueBanner() and
  createPageIssueBannerMultiple() into insertPageIssueBanner() as the
  code was quite similar and were it a true component, it would probably
  be a single component.

All new files appear under page/ to keep their distinction from the
overlay code clear.

Some view logic remains in pageIssues.js but it shall be difficult to
isolate.

Bug: T212376
Change-Id: Iccce709c34fa8de5a28a5a00098add5775e3dc9a
2019-02-13 00:42:56 +00:00
jenkins-bot e668cd36d7 Merge "Revert "Hygiene: Track minerva errors count only once"" 2019-02-11 18:27:52 +00:00
Jdlrobson 29bfece958 Revert "Hygiene: Track minerva errors count only once"
We talked about this in standup today and given Sam's comment
in T212970#4943448 and a potential loss of data, we've considered
this a little risky and would like to revert and discuss this.

We can reapply the patch later if necessary.

This reverts commit a486bde329.

Bug: T212970
Change-Id: I0aad3937dde92bf7a46df8c1cf892bf5ce257e17
2019-02-11 18:11:16 +00:00
Stephen Niedzielski 66c44402d7 Hygiene: replace OO.mfExtend with mobile.mfExtend
Use the mobile.startup module mfExtend export directly instead of
OO. This will allow MobileFrontend to reduce its exposed API.

Bug: T208915
Depends-On: Idededf132f724176c38c5e0a7c9327f00489a09d
Change-Id: Id582325c830c229240b88cf4e151afea48fea750
2019-02-08 21:42:03 +00:00
Stephen Niedzielski 28b0aa441d Hygiene: rename mobile.startup variable in search
Rename `client` to `mobile` in search.js. This was the only deviation in
naming when persisting `M.require( 'mobile.startup' )`.

Bug: T208915
Change-Id: I46f8a7a560cbb78fdec970cc0d2eff32238bf59e
2019-02-08 13:52:54 -07:00
jenkins-bot 578eb28966 Merge "Hygiene: move PageGateway import to top" 2019-02-08 20:09:53 +00:00
Stephen Niedzielski 9cf8da6514 Hygiene: move PageGateway import to top
Move synchronous import to the top of the file next to other
mobile.startup imports to make it easier to find.

Bug: T215648
Depends-On: I6393e4403034cce51c01003bdf5bcaf3b76ae9f1
Change-Id: Icf52160b84f05a4ac3e069112460cf0bc97a0b4b
2019-02-08 11:59:16 -08:00
jenkins-bot 4bf79bd6df Merge "Merge skins.minerva.scripts.top and skins.minerva.mainMenu into scripts" 2019-02-08 19:10:03 +00:00
jenkins-bot 2496a33fa8 Merge "Hygiene: Track minerva errors count only once" 2019-02-08 15:57:39 +00:00
jdlrobson b356c7f134 Merge skins.minerva.scripts.top and skins.minerva.mainMenu into scripts
These modules can safely be merged.

Since skins.minerva.scripts.top is added via addModules to the HTML it must
be marked as deprecated and remain temporarily as a redirection to skins.minerva.scripts

All modules have been renamed to be in there new home - no deprecation notices are needed
as they are not used outside Minerva.

I leave skins.minerva.mainMenu.styles as it is used by Special:MobileMenu
and needs to continue to do so.

Change-Id: Ie919151630f4389f8e84e808bec003a6d3d07bd9
2019-02-07 18:10:15 -08:00