Commit Graph

177 Commits

Author SHA1 Message Date
Piotr Miazga 6352190684 Hygiene: Extract isAllowedPageAction into MinervaPagePermissions
The isAllowedPageAction is used in multiple places (SkinMinerva
and in PageActions toolbar builder). This logic should be defined
in separate service, easy accessible for different parts of the
Minerva skin.

Changes:
 - Introduced MinervaPagePermissions as a centralized place to manage
 user permissions
 - Introduced MinervaNoTitlePermissions, an NullObject pattern to
 handle situations when we do not have Title object (like in CLI)
 - removed Minerva.ContentHandler service as it's not required any
 more
 - moved all permission names into constants
 - moved isTalkAllowed() into MinervaPermissions
 - renamed isAllowedPageAction() it `isAllowed()` to not mix it
 with PageActions. Those checks are used in many places, not only
 on PageActions menu
 - made isAllowed( watch ) more robust - now it checks that Title
 is watchable

Bug: T221792
Change-Id: I87d44a9c717b5f752b8d1fd2f146d7f5eef3c53f
2019-06-21 15:30:11 +00: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
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
jenkins-bot 3d73282dc9 Merge "JSON content: Fix table margins" 2019-05-09 17:31:21 +00:00
Ed Sanders d6dc73063d JSON content: Fix table margins
Change-Id: I50a2203adb66e634f9d995225075dc29a34ab4dd
2019-05-08 11:37:57 -07:00
Jan Drewniak 4ad1b511c0 Add Minerva specific mediawiki.interface.helpers.styles.less file
This SkinStyle file adds paranthases around the (diff|hist) links
and username(talk|contrib|block) links on special pages.

Bug: T222394
Change-Id: Ic291cb795ccad556a5049d970c0282b2d4c65a11
2019-05-07 15:54:13 +02:00
Jan Drewniak 2ce755fdb2 Adds a light-blue variant to the external link icon
The light-blue variant is used in reference drawers
on a dark background.

Bug: T216961
Change-Id: Ic8fdf8f4a08ea7c8d7ae57ae8ce02a7d9a1e1dad
2019-05-04 01:12:05 +00: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
jdlrobson 6ade2b1ec6 Reset history page styles for Minerva
This provides us with a blank canvas for styling Minerva's history
page in AMC mode.

I have also provided styles for a non-AMC mode (test by changing
the class on body tag to minerva--amc-disabled). This will allow us
to remove the SpecialMobileHistory page in mobile if we choose to
do so.

Change-Id: Ic57cb79903e90ce1bbfa6d87ab0499f09373e732
2019-04-23 10:17:50 +02: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
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
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
Piotr Miazga 258e635ae5 Extract SkinOptions to separate class
SkinOptions array was used to determine which options are available
for current session. Once we started extracting things from
SkinMinerva class, we found out that lots of things depend on
SkinOptions.

For example MainMenu/PageActionsMenu depend on skinsOptions var.
We could pass $skin object as dependency to a menu builder, but
this would cause a circural dependency (Skin depends on menu builder,
menu builder depends on skin) which is an anti-pattern.
In order to avoid such situations lets prepare first, and extract
the SkinOptions to a separate class, register it as a service
so different parts of Skin Minerva can freely use a single instance
of SkinOptions object.

Bug: T216152
Bug: T221012
Change-Id: Icd5da546e1bfaf8d9bfe86dab3b659a88eae19e4
2019-04-15 20:34:12 +00:00
Piotr Miazga 572ffdf25a Use MediaWikiServices to cache commonly used helpers
SkinMinerva cached the ContentHandler object for better performance.
In the future the ContentHandler will be also used in the Menu,
for better readability, store ContentHandler as Service.

MediaWikiServices will initialize service on first access and cache
it for future needs. Same applies to SkinUserPageHelper,

Bug: T216152
Change-Id: Ia98dc860862360a68556272714669f0c3a13eb1e
2019-04-15 20:50:11 +02: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 a81f1492d2 Add MobileWebMainMenuClickTracking to Minerva EventLoggingSchemas array
This used to be in MobileFrontend. Now it is in Minerva where it is
better suited.

Depends-On: I74ec4d9026ccb9200925068fd9dc458beb765501
Bug: T218627
Change-Id: Iefa772b2b619eca238b6fe8821d246c966cb0a04
2019-04-01 15:20:41 -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
Piotr Miazga 6c2450a5f2 Track share button usage
Use MobileWebShareButton schema to track interactions with

Additional changes: Fix how button is injected into page actions
bar as last AMC changes broke it.

Bug: T207280
Change-Id: Ie7d7ab6bc66df5ab30aaec77e2ee8583c69b8f48
2019-03-18 09:03:42 -07:00
Jan Drewniak c0ab8046ac Add config option for showing history link in page actions menu
Bug: T213352
Change-Id: I6a53a7303434b0fd374bc5b6ea2dbc8e760807e6
2019-03-07 21:50:57 +01:00
Nicholas Ray b45120731f Import all skinStyles/mobile.startup into mobile.startup.less
This mimics the structure we follow in MobileFrontend's mobile.startup
folder where we have a mobile.startup.js that imports all the
mobile.startup files.

Bug: T215657
Change-Id: Id7faa45adce7c5aa870d0f7c92f70d39995adac0
2019-02-22 11:59:03 -07: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
jenkins-bot 6865c3f7c7 Merge "Set editfont size to 16px (100%)" 2019-02-15 21:16:43 +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 4b7aabca6f Merge "Talk tabs in AMC mode" 2019-02-13 00:40:50 +00:00
jdlrobson 7e423c07b7 Talk tabs in AMC mode
A new feature/skin option is added that is enabled safely inside
a MobileFrontend available/unavailable hook that changes the skin
to place talk tabs at the top of the page.

These new talk tabs purposely show on the main page, user page
and standard pages and do not show on special pages.


Depends-On: Ie1a583657176acc6f7046c569c2e94fa2f72ff93
Bug: T212216
Change-Id: I57b70cd325666a287678dc897159b5bf9d089b78
2019-02-13 00:02:35 +00:00
Stephen Niedzielski f26ae2212e Hygiene: remove deprecated RL module skins.minerva.scripts.top
skins.minerva.scripts.top is no longer needed as of b356c7f. Remove the
ResourceLoader module.

Change-Id: I4db0551a7661eb5c41d7b2a27e78afb885bb9ce5
2019-02-12 23:46:07 +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
Stephen Niedzielski 8d67044f3d Hygiene: remove unused string
Remove mobile-frontend-language-change which does not appear to be used
by Minerva or other repos.

Change-Id: I3a6e3bff921a46575b1c3cc7d914ace35a321b35
2019-02-05 11:30:29 -07:00
jdlrobson ff83465346 skins.minerva.editor is never loaded
This is never added to any page.
Remove it.
mobile.editor inside MobileFrontend is already added
via the onBeforePageDisplay hook there.

Bug: T213340
Change-Id: Iea025ee48ee95b6d9470ad055fa717e3e3ade54a
2019-01-24 11:10:37 -08:00
jenkins-bot ffb97f5c9f Merge "Hygiene: Merge skins.minerva.base.reset into skins.minerva.base.styles" 2019-01-18 17:13:52 +00:00
jenkins-bot a816f81278 Merge "skins.minerva.tablet.styles can be merged" 2019-01-18 17:13:51 +00:00
jdlrobson 7e81cfa663 Separate ConfirmEdit styles from Login styles
ConfirmEdit styles are migrated from mediawiki.special.userlogin.common.styles
to ext.confirmEdit.fancyCaptcha.styles

The text of the reload itself mirrors the progressive blue icon by being
progressive itself

A couple of tweaks to the form (padding) are made to preserve the form to
its previous glorious status, other than that the file remains the same.

Bug: T213775
Change-Id: I2322194481e4d6b7662c0f075768d5941afa98b8
2019-01-17 23:48:54 +00:00
jdlrobson 24b1e7d54d Hygiene: Merge skins.minerva.base.reset into skins.minerva.base.styles
No need for 2 modules that are both loaded on every page load
Provided consumers are loading skins.minerva.base.styles they will
continue to get the same CSS. If any consumers exist that load
skins.minerva.base.reset but not skins.minerva.base.styles they will
need to use their own css reset file
(e.g. https://meyerweb.com/eric/tools/css/reset/)

Change-Id: I599e6d5a84b311cb3bb2da197da1b688e0e6b9d4
2019-01-15 12:30:32 -08:00
jdlrobson 1166009c00 skins.minerva.tablet.styles can be merged
This module is unnecessary - it's loaded unconditionally on a page.
Instead bundle the related CSS inside skins.minerva.content.styles

Change-Id: Ieb37d63332ff5b0cf39835b64cc9f0dcaf62c34f
2019-01-15 12:30:30 -08:00
jdlrobson 76be18c788 Tablet code no longer needs to be conditional
The TableOfContents component is now inside mobile.startup
so is readily available.
Thus skins.minerva.tablet.scripts is removed and its code
moved inside skins.minerva.scripts

The check to whether the user is in tablet mode
now happens inside toc.js

The resize handler is dropped on the basis that this is an edge
case that is not worth supporting at the cost of an eventBus.

Depends-On: I353d6d7a6884dae03b55364150c6bb95cd4cc57f
Change-Id: Id16a64573e020b4606fc9b11456163a4cd290e0b
2019-01-14 15:43:50 -08:00
jenkins-bot d3557a738d Merge "Generate a shareIcon via composition" 2019-01-04 18:57:13 +00:00
jdlrobson e3bdad20bb Generate a shareIcon via composition
Bug: T205592
Change-Id: Ia107b13d4f658ce7cc077ca7337530f3e448c522
2019-01-04 09:19:59 -08:00
jenkins-bot 9258806a0f Merge "pageIssuesOverlay is a factory function that returns an Overlay" 2019-01-04 15:39:48 +00:00
jdlrobson d29eca2bc8 pageIssuesOverlay is a factory function that returns an Overlay
This experiments with making PageIssuesOverlay an Overlay with
various options.

The appending of children is a little messy and points at a need
to standardise this some way
(see https://phabricator.wikimedia.org/T209647)

TODO:
* Remove the iconString property on PageIssueSummary which is no longer
needed

Bug: T209647
Change-Id: Iadd798a820dca6bbb31edc9a8570b6db7aac237a
2019-01-03 08:31:39 -08:00
jdlrobson c73ff1f7a5 Composition: DownloadIcon
The DownloadIcon is reduced to a factory function that
returns an instance of Icon

Depends-On: I4d703eef68d51bbe0b03579c5cca0845e17b8c9d
Depends-On: I4a4129b2cac7c7c49559beef0b8780f3211edf9c
Bug: T205592
Change-Id: Ib87390d17bef6f50842f52cd84c9ce2b162aaff0
2019-01-02 13:16:09 -08:00
Stephen Niedzielski 37333c7189 Hygiene: collapse mobile.search* into mobile.startup
MinervaNeue depends on mobile.search and mobile.search.api. These
ResourceLoader modules existed in MobileFrontend but now have been
collapsed into mobile.startup.

This patch updates Minerva's ResourceLoader module and JavaScript
references.

Bug: T210207
Depends-On: I1eae36f2927a4e0f9d1e91d604d656beb8cc33ae
Change-Id: Ied6f4873bf2550564673296e9ef4fa009ca45e5b
2018-12-17 22:03:41 +00:00
Stephen Niedzielski 0cb19335fa Hygiene: collapse mobile.search LESS into mobile.startup
MinervaNeue depends on mobile.search. mobile.search's LESS has been
collapsed into mobile.startup. This patch updates Minerva's references
and revises the SearchOverlay's CSS selector to increase specificity to
account for the new order of CSS files. Previously:

- ...
- MobileFrontend Overlay.less
- MobileFrontend SearchOverlay.less
- ...
- Minerva Overlay.less
- Minerva SearchOverlay.less
- ...

Now:

- ...
- MobileFrontend Overlay.less
- Minerva Overlay.less
- ...
- MobileFrontend SearchOverlay.less
- Minerva SearchOverlay.less
- ...

Since SearchOverlay's selector are intended to override Overlay's, it
seems appropriate to specify that a SearchOverlay is also an Overlay and
increase specificity.

Bug: T210207
Related: Ib0316020ed10eb0c921a3300501df7634a889977
Change-Id: I5c06b13f22f530fb52f37f373e081ed55f332a07
2018-12-17 22:02:58 +00:00
Jan Drewniak 1589a15862 Remove references to "mobile.toggle" module.
mobile.toggle was folded into mobile.startup in
mobileFrontend, so moving references to that instead.
- Changing require statements
- moving skinStyles/mobile.toggle/minerva.less to
   skinStyles/mobile.startup/toggle.less
- Replacing references to mobile.toggle in skin.json

Depends-On: Iecc1870f08532e8c7893861afdd54f069da54be2
Bug: T210208
Change-Id: Ie67cd50a2d042fbbaaef348b9b62d64193900d78
2018-12-14 00:45:34 +01:00
jdlrobson 87942c34f9 mobile.watchstar is a deprecated module
Referencing it triggers deprecation warnings so should be updated

Bug: T208921
Change-Id: I7266a067a14bfa38a998f426e18f096515b7bfa7
2018-11-30 15:28:03 -08:00
Ed Sanders d63de2eb01 Set editfont size to 16px (100%)
Change-Id: I9bff880de792da756f14726042df0a0df4139d1b
2018-11-27 22:56:01 +00:00
jdlrobson 5c40ddc477 Zero is a sensible default for this feature flag
Bug: T205008
Depends-On: I3640b28c6a930f6e934d22c3375bffcd539902aa
Change-Id: Ie5d63e265469219063e36d6e398fd0a0b1e864db
2018-11-27 12:26:37 +00:00
jenkins-bot 58cfdbff89 Merge "page issues is feature flagged" 2018-11-20 22:44:40 +00:00