Commit Graph

239 Commits

Author SHA1 Message Date
Santhosh Thottingal 80484b74de
Fix a comment about SkinMinerva::buildPersonalUrls
Change-Id: Iaff610894ee34f343a735990614e569b4682a4f2
2019-05-27 12:10:20 +05:30
Jan Drewniak 078aab76d8 Adds AMC styles for action=history page
Styles the action=history page to resemble it's desktop
counterpart for users in AMC mode.

Bug: T219895
Change-Id: Ide359724a4628f69ef03acee7718d70c698b8faf
2019-05-22 14:24:43 +02:00
jenkins-bot c4b31067ab Merge "Provide IMenuEntry interface" 2019-05-17 13:12:09 +00:00
jenkins-bot 7a83809f4d Merge "Minerva shouldn't call Skin::getNewTalks() twice" 2019-05-14 15:34:44 +00:00
Piotr Miazga 39a2078472 Minerva shouldn't call Skin::getNewTalks() twice
The Skin::getNewTalks() is already called in SkinTemplate::prepareQuickTemplate.
There is no need to call this function again, as is pretty heavy. Instead of
calling it second time, just re-use the value stored in the QuickTemplate

Change-Id: I0e9491405f4d760278db3a423ee14e8f80720291
2019-05-14 16:09:18 +02:00
Piotr Miazga 6905b85d67 Provide IMenuEntry interface
The Group shouldn't depend upon concrete MenuEntry definition.
Different Menus can present different MenuElements. Code should
allow easy extensions, not limit only to single MenuEntry
definition.

Changes:
 - introduced IMenuEntry interface
 - MenuEntry implements IMenuEntry
 - removed isJSOnly from logic as it's related only to one menu
 element (Watchstar) and Group shouldn't be aware of some special
 handling for some elements. The IMenuEntry shouldn't define this
 method
 - getName, getComponents, getCSSClasses should have defined return
 types

Bug: 1221792
Change-Id: I0646df734e869c26bfa8c3a772200e8258a8acce
2019-05-14 13:12:37 +02:00
Piotr Miazga 6c70498e91 Hygiene: Deduplicate MenuEntry uniqness check code
The check to verify uniqness of the MenuEntry $name existed
twice, in insert() and in insideAfter() methods. To respect
"do not repeat" yourself rule, we should keep this check
in one place only.

Bug: T221792
Change-Id: I973b0427623e579f97ae47f7c80dc2a9db2fcca7
2019-05-14 11:38:39 +02:00
jenkins-bot b503d36560 Merge "MinervaNeue doesn't need PersonalUrls" 2019-05-08 18:35:04 +00:00
Piotr Miazga 339f1f5789 MinervaNeue doesn't need PersonalUrls
MinervaNeueu do not use any of personal urls on the page. There is
not need to calculate that.

Change-Id: Ie8febe2dc9c03e8988e7100c4656aea65f76e1f1
2019-05-07 22:23:57 +02:00
Piotr Miazga 44d5ffd6e9 MinervaNeue has no sidebar, do not process this method
MinervaNeue doesn't show any sidebar, only MainMenu and
PagetActions menu. There is no need to call original
Skin::buildSidebar() as the result is not used.

Change-Id: Iec60491d4b45b7b6f6ba23525a4f6af08903bb31
2019-05-07 22:21:10 +02:00
Piotr Miazga 26fea403c2 Harden Definitions::insertCommunityPortal() method
Looks like Title::newFromText() can return null instead
of Title object. Code has to support this edge case.

Bug: T222407
Change-Id: Ie34a26303df8e27247e51ddc2b13e3c2fa59a435
2019-05-04 01:13:05 +00:00
jenkins-bot e0624d1725 Merge "Improve Community Main Menu element handling" 2019-05-02 18:05:46 +00:00
Piotr Miazga 0ef74abc2d Improve Community Main Menu element handling
The Commmunity Portal main menu element should be handled
same way as Skin::buildSideBar() does:

 - it should ignore "-" -> this is how editors disable the
 link
 - it should use inContentLanguage() to properly support
 different languages

Bug: T216152
Change-Id: I41b2373fd1b55d9d4beaba60eeb362e6188d24de
2019-05-02 17:08:29 +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
jenkins-bot efcc4792a4 Merge "Hygiene: Various cleanup in Minerva PHP code" 2019-04-20 00:50:19 +00:00
Derick Alangi 2681fa1b13 Hygiene: Various cleanup in Minerva PHP code
Cleanup ranges from removal of unused variables, fixing of method
case mismatch, collapsing of multiple `if` statement that can be
combined into one.

Change-Id: Ib9d6e2e4d747da699067c0c0a9aab5e8af29aef2
2019-04-20 00:37:09 +00: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
jdlrobson e836083ad1 Consult "shouldUseSpecialHistory" when making history page link
This avoids an unnecessary redirect in mobile for AMC users.
Bug: T219874
Change-Id: I049045d44f6e45ebb2c81f90aac4bb20831890df
2019-04-08 22:05:44 +00:00
jenkins-bot e0f96e5f7c Merge "Hygiene: remove outdated comment in footer.mustache" 2019-04-04 18:15:30 +00:00
Stephen Niedzielski 4f2c12bf2e Hygiene: remove outdated comment in footer.mustache
Remove old comment. I think this may have been referring `{{.}}` but
that's not present.

Change-Id: If2443027cfc2da970f4c986c6a85406161ee9173
2019-04-04 17:43:35 +00:00
jdlrobson 0be05950af Desktop should use AMC mode
To help us test special pages prior to moving them on mobile it
would be useful to make AMC the default on desktop
where the special page override does not exist

This is also probably what editors on desktop using the Minerva
skin want out of the skin.

On top of this, add an amc class to the body tag so we can
target styles at AMC and/or non-AMC users

Change-Id: I7f3141bae71181131ae4878fd21fb6ff4322c8ca
2019-04-04 17:43:12 +00:00
Stephen Niedzielski a3e524192d Hygiene: reduce getPageActions() visibility
- Reduce MinervaTemplate.getPageActions() visibility from public to
  protected. No one seems to use it.

- Use camelCase instead of lowercase for the pageActionMenu.mustache
  template's pageActions variable. writingwithcaseindifference is
  difficult to read and the templates seem to support casing.

Change-Id: I6d283c7b97eeef6902cb010904748bd8c72b660c
2019-04-04 16:51:42 +00:00
Derick Alangi 88854b90d4 skins: Fix function name case mismatch for getLocalUrl()
Change-Id: I827b27f1caaf36d7bb96f96ede8ca759f94f0b13
2019-04-04 13:30:22 +01:00
Timo Tijhof 23a0f5f78c Simplify code in SkinMinerva::getHeadingHtml
The conditional and comment here were probably copied from
MonoBook or Vector. There, they were used to decide whether
to output an H1 or not.

The way the conditional was placed here, though, was a no-op.
When this condition was false ($pageTitle == '') the implicit
behaviour was to leave $heading unchanged, which is '', hence
it is using the very value it pretends to reject.

Remove this indirection as it behaves the same either way.

Change-Id: Id3056b199172bbd21b350f920dd0640241b0dd95
2019-04-02 20:18:57 +01:00
jdlrobson bb4e8b8689 Do not show page actions bar on action pages
The page actions bar should not show on the following
pages:
?action=history
?action=edit
?action=unwatch
?action=watch

Change-Id: Ib54c332a221d4a1b64064807e693c8882ef97938
2019-03-26 09:59:33 -07:00
Jan Drewniak a809420f8d Add IDs to page-action menu items.
Bug: T215890
Change-Id: I3330f3ccc8226605f44745befc34dcfcc7c474d8
2019-03-26 16:33:03 +00:00
jenkins-bot 1aaad74847 Merge "Remove skins.minerva.icons.images.variants module" 2019-03-22 17:45:04 +00: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
Jan Drewniak b2607d3a1a Only show history link in page-actions menu if page exists
Bug: T213352
Change-Id: Ib51c68679426fdf0bd4cc33aeda37decebfd4ace
2019-03-21 16:20:22 +01:00
Derick Alangi b3c5745808 includes: Code cleanup for the Minerva codebase
These code cleanups involves the following;
- Consistency in using single quotes as already been
  used in the code base for loading resource loader
  test modules.
- Remove irrelevant else cases when there is a return
  statement in the if cases.
- Remove passing objects as references as they're already
  by default passed by references so no need for &.
- Proper call to getLocalURL() instead of getLocalUrl()
  though PHP doesn't really care much about the case but
  let's use the function names as they are.
- Fix PHPDoc params, remove useless $skin wrongly placed
  in the comment.

The changes in this patch doesn't affect the behavior of
the current system in any way.

Change-Id: I9c886c058592486b7190b9567f79c496855f4ae3
2019-03-19 21:08:57 +01: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 835d54b3dd Remove unnecessary parameter from `getHistoryPageAction`.
Change-Id: I7ff1dee39be6b2cd213cf963605aff3c75bddc96
2019-03-13 11:34:57 +01: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
Jan Drewniak 69511f16b6 Add history icon to page actions menu for AMC mode
Bug: T213352
Change-Id: I6ba11c5969e03bf71fb891558fde68215e978083
2019-03-07 00:45:53 +00: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 3f7d1e3601 Return to link is not needed in AMC mode on talk pages
The tabs render this unnecessary

Bug: T212216
Change-Id: Ibb19448529a43bb542eb112ff3b113ca0c3749a4
2019-02-26 10:33:26 -08:00
jdlrobson d3a95084c5 Talk is at bottom of main page
In T214724 the talk tabs were removed from the main page in
AMC mode, however this also removed the talk button
altogether in AMC mode. This updates the logic.

Talk tabs are also
removed from the talk page for the main page
as the tabs come as a pair.

Bug: T214724
Bug: T216514
Change-Id: Ic7d54e323d9428fa222e27a86ec2f9d61ae1e5f5
2019-02-20 14:03:03 -07:00
jenkins-bot b32056350a Merge "Banner now nested inside main article at top" 2019-02-20 20:01:25 +00:00
jdlrobson 1146ebd2d9 Banner now nested inside main article at top
Bug: T205360
Change-Id: Idebb161519e0b50c1f464f409ffdf62b634a4e6d
2019-02-20 11:17:09 -08:00
Jan Drewniak f92b117158 Remove margin from tagline and add .page-heading element
Even though on most pages the tagline is empty, it still
has a bottom margin associated with it. This patch moves
that bottom margin into a container element that wraps
both the h1 and tagline.

This approach allows us to remove the bottom-margin from the tagline
as well as the top-margin from the AMC tabs in favour of just
one bottom margin on the .page-heading element.

Bug: T214195

Change-Id: I67d3938ab4a75f994acc28a8eefdf19e531c1f3d
2019-02-19 12:37:27 +01:00
jenkins-bot 25d71b432e Merge "User actions below page actions" 2019-02-18 14:39:18 +00:00
jdlrobson 260fa21bfd Define AMC flag as false by default
Not doing this triggers a PHP notice on all pages

Change-Id: Ie171e53985a56c27d91aa6bae19a0d3f60bc9619
2019-02-13 13:44:05 -08:00
jenkins-bot 74c6e33093 Merge "Talk tabs disabled on main page" 2019-02-13 20:10:39 +00:00
jdlrobson 4807b3c6fd User actions below page actions
I have decided not to worry about cached HTML.
Some pages will display the links inconsistently, but that's
okay.

Bug: T214697
Change-Id: I16f0f999f915aed8316d8a9b4fbbed9a2971d59e
2019-02-13 11:41:28 -08:00