Commit Graph

566 Commits

Author SHA1 Message Date
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
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
jdlrobson b9862d7d24 skins.minerva.options uses packageFiles
I want to remove the need for M.define in the Minerva repository.
It's no longer necessary with packageFiles and will help tame
a lot of the code we have here!

Change-Id: If6a35a23e84a44adb965fd9c41265ba37eb8368e
2019-07-08 17:22:11 +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
jenkins-bot 141d9a89ed Merge "Don't scroll vertically when scrolling active tab into view" 2019-06-25 14:13:24 +00:00
jenkins-bot 62090bcd69 Merge "Use wgRelevantPageTitle when setting up talk overlay" 2019-06-25 10:21:53 +00: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
Stephen Niedzielski 1e61706e0e Hygiene: rename "secondary button" to "user notifications"
The secondary button is not generic. Rename it to match its specific
purpose.

Bug: T214540
Change-Id: I50b7e7fa7bea91a029a8ca71199b0309dff1c518
2019-06-19 11:31:16 -06:00
jenkins-bot 1aa31ea5b8 Merge "Correct Wikidata icon color in overflow menu" 2019-06-19 14:10:38 +00:00
Nicholas Ray 9676395529 Correct Wikidata icon color in overflow menu
This icon's stroke was explicitly set to `#000` before this commit, but
we need its color to be `#54595d` to match the other icons in the
overflow menu [1]. Unfortunately, although we set a variant in skin.json
for the icon to be colored this way [2], there are 2 problems that
prevent it from displaying this color:

1) The icon sets an explicit black color for its stroke attribute
2) ResourceLoader currently only sets the fill color on the `g` element
when applying the variant style [3]. It does not set the stroke color. Even
if problem 1) was removed, we would need RL to set the stroke color, but
I'm not sure how that would affect other variant icons that RL deals
with.

The simplest possible solution is to to change the stroke attribute on
the icon itself, although it unfortunately introduces technical debt as
this icon now differs slightly from the OOUI one :(

[1] https://phabricator.wikimedia.org/T222630#5266575
[2] https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/master/skin.json#L262-L267
[3] 4e59467427/includes/resourceloader/ResourceLoaderImage.php (L331)

Bug: T222630
Change-Id: I8c10a6012c7d32ab8555b874e766bc2f36437cf8
2019-06-18 17:05:26 -06:00
Ed Sanders 240280b906 Tabs: Remove unnecessary flexbox styles
white-space:nowrap is simpler and better supported.

Change-Id: I8c44cdd3c30a4cad1817b7912f9bbaae9e5ef641
2019-06-18 21:36:28 +01:00
Stephane Bisson 5a3a8efc31 Use wgRelevantPageTitle when setting up talk overlay
wgRelevantPageTitle is generally the same as wgPageTitle.
It is different on special pages that act on a page.
For example, on Special:WhatLinksHere/Moai
  wgPageTitle => Special:WhatLinksHere
  wgRelevantPageTitle => Moai

This change would allow Special:Homepage to have the talk overlay
connected to its talk tab.

If Minerva has such special pages that act on a page AND those
pages have talk links AND the 'skins.minerva.talk' happens to
be loaded, those links would now show the talk overlay.
I found no such cases but I cannot say they don't exist.
I also don't know if this change would be a regression
or an improvement.

Bug: T225659
Change-Id: I5d60ff3f0295f44a6d59cd772e27656b69ef0972
2019-06-18 15:38:33 -04: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
Jan Drewniak 0213011285 Updating icons for AMC mode
Replaced the following icons:
- communityportal.svg
- specialpages.svg
- info.svg
- contributions.svg

Bug: T222228
Change-Id: Id7889aeb99abe39bc0efae0a1c6457826015302b
2019-06-07 00:25:21 +02:00
Jan Drewniak ed9f455545 Adding a reflist.less file to hold Template:Reflist specific styles
Template:Reflist needs a larger column-gap to be consistent with
the Vector skin.

Bug: T150377
Change-Id: I14911f9b0fa46249cf11a591bc5323a227f7c3cc
2019-06-03 14:27:50 +02:00
Jan Drewniak 650198b7bb Fix z-index issue with button on action=history page
When opening/closing the main navigation, the large blue button
on the action=history page is visible above the opaque page content.

This changes the z-index when the main navigation is enabled.

Bug: T219895
Change-Id: I724c2419800a4aec0b55b18be920d8bf7e47fa60
2019-05-27 16:48:09 +02: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
Volker E 9845433bf1 Remove unused 'sectionAnchor.less'
File is not referenced and not in use as MF removes class.

Change-Id: I4fb9f887f38b991ac809903a120844d24fbbcac6
2019-05-09 08:07:43 -07: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 17b821861a Merge "Fix: AMC overflow menu initial CSS and SSR icons" 2019-05-01 21:06:18 +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
Stephen Niedzielski b594daf8c8 Fix: AMC overflow menu initial CSS and SSR icons
When advanced mobile contributions is enabled and the overflow menu is
shown:

- The initial state should have no transition. This prevents the menu
  from flickering initially. Move the transition to the checked state
  only.

- The icons should be available for server-side rendered HTML without
  JavaScript. Add wikimedia.ui to the SSR modules.

Bug: T216418#5129152
Change-Id: I3b91f6cdefd4b727c2fb512272d8c4282af632bf
2019-05-01 09:29:50 -06:00
Volker E cd61867f0a Unify `ul` bullet styling
Unifying unordered lists bullet styling with Wikimedia Design Style
Guide defaults and other products.

Bug: T220323
Change-Id: Ifa990010cf80010cd3184f9bcb72fc081674db05
2019-04-30 10:25:35 -07:00
Volker E e562227392 Remove `ol` overrides to ensure list styles in non-Arabic number scripts
Bug: T205341
Bug: T217616
Change-Id: I66a677ab5d7ea4555d16d5761340eaad4158c3bc
2019-04-29 21:53:15 +02:00
jenkins-bot f1ccfd50e1 Merge "Switch to outside list style for ordered lists too (second try)" 2019-04-29 19:45:14 +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
jenkins-bot 55ad654176 Merge "Update: add secondary page actions submenu in AMC mode" 2019-04-19 22:15:22 +00: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
jenkins-bot 6cd23276b2 Merge "QA: Port Notifications browser test to Node.js" 2019-04-19 12:07:16 +00:00
Piotr Miazga 692309090d Remove Recent Changes from Main Menu
We decided to remove the Recent Changes menu entry from Advanced
menu for now, we might come back to it later.
For more info: https://phabricator.wikimedia.org/T216152#5123296

Bug: T216152
Change-Id: I6342e273fdc5f483692de6e1ac238c38d06f3e5f
2019-04-18 20:32:23 +02:00
jenkins-bot 8767b8ad18 Merge "Add basic `hr` element styles" 2019-04-17 20:16:01 +00:00
Piotr Miazga 2cf4ed8981 Add Community Portal link to Mobile Main Menu
Changes:
 - introduced new icon for Community Portal
 - added new menu entry in Advanced Builder that links to
 MediaWiki:Portal-url

Bug: T216152
Change-Id: Id38836d8f1a62d4e15181ab10e219d5c5b769ec3
2019-04-16 11:21:43 +00:00
Piotr Miazga 1f4582cc09 Provide a code structure for menus handling and add Advanced menu
Changes:
 - moved all menu elements definitions from SkinMinerva into
 a separate Definitions.php file
 - moved menu building from SkinMinerva into includes/menu/Main
 folder
 - introduced Builder pattern for easy menu building
 Minerva/Menu/Main/Director takes an Minerva/Menu/Main/IBuilder
 and builds the menu. The IBuilders use definitions from
 Minerva/Menu/Definitions file, so all definitions can be shared
 across different menus
 - used ServiceWiring file to register MainMenu Director as Service
 - left class_alias for old MenuBuilder as some extensions still use it
 - The hooks system have to stay like that as some extensions
 are using it (BlueSpiceMultiUpload and GrowthExperiments).
 - introduced AdvancedMenu builder for the AMC mode

Bug: T216152
Change-Id: I210c3f1fa36bbd2f9108d728b12cbb21ee210354
2019-04-16 13:19:51 +02:00
Volker E 5f6f75e487 Add basic `hr` element styles
Bug: T221020
Change-Id: I90cef54b48d5934dac4adac6be6ffe7145a726f4
2019-04-15 17:43:09 -07:00
jdlrobson c16c20a394 QA: Port Notifications browser test to Node.js
Uncover a bug and fix it in the process \o/ - it seems that the
close icon is misplaced between clicking the notifications icon
and loading the contents of the overlay - this confuses the webdriver
as the button is not clickable.

Bug: T219920
Change-Id: Ib4d076fd9b7ea1cd48b6b58940a50560eacd51a0
2019-04-11 13:26:39 -07: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
jenkins-bot f9ac8d40e5 Merge "Increase `margin-top` for `h3` following `p` elements" 2019-04-04 18:15:34 +00:00
Volker E 6a078ddb65 Increase `margin-top` for `h3` following `p` elements
With Id00fbe7ca90a in, this inharmonious, too close distance has
become more obvious.

Bug: T219572
Change-Id: Ie9689d29b6553aadf8ec4781369ec966b4a34abe
2019-04-04 18:01:55 +00: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
jenkins-bot 381170d00e Merge "Provide focus styles only in overlay" 2019-04-04 10:17:46 +00:00
Volker E 1c2a354a78 Provide focus styles only in overlay
Preventing double transition in search input focus by limiting styles
only to non-JS or when JavaScript enabled to the overlay.
Also introducing standard transition to smoothen it further.

Bug: T218154
Change-Id: I2344bfc7c4edc1941119565d7b113788e8713624
2019-04-03 19:46:53 -07:00
Volker E 681a752f29 Remove `.background-size()` mixin usage
Removing deprecated LESS `.background-size()` mixin calls.
Also
- simplifying code, where second (height) value is automatically set
  to `auto` when only one value is set and
- removing stylelint rule.

Bug: T219956
Change-Id: I643c66b3067ba77726d76cbebf7550781e18aa5d
2019-04-03 18:02:48 -07:00