Commit Graph

235 Commits

Author SHA1 Message Date
Piotr Miazga 209becf63d PageActions menu should use Builder pattern
The PageActions menu shouldn't be built inside SkinMinerva class.
All menus should be build in similar way so it's easier to understand
how different parts of the system work. This will allow us to easily
track different menu elements/move elements between different menus.

Additionally we should allow extensions/3rd party to modify both the
toolbar and overflow menus.

Changes:
 - Removed PageActions logic from SkinMinerva class
 - introduced new PageActions/Director to build page actions menu
 - introduced Builders for toolbar, and different types of overflow
 menu
 - because Overflow menu elements require the
 BaseTemplate::data['nav_urls] array, instead building all links,
 pass the array when building PageActions menu. Code for getting
 menu entries had to be rewritten (use $navUrls array instead of
 $this->tpl['nav_urls'];
 - ServiceWirings file contains logic on what to pass to
 PageActions/Director class (which builders)
 - PageActionsMenuEntry setTitle() and setNodeID() returns $this
 so we can use method chaining. Only a syntax sugar.
 - if AMC is not available/Overflow menu is disabled via config,
 system will pass EmptyOverflowBuilder. System will not add
 "show more" icon to toolbar menu when $overflowBuilder returns
 empty set of options.
 - both ToolbarBulder and OverflowMenuBuilders (except
 EmptyOverflowBuilder) will run 'MobileMenu' hook. Extensions should
 listen to hook, and inject it's own menu entries at their leisure.

Required follow-ups:
 - SkinMinerva provides isAllowedAction() method which is used
 both in the skin code and in Toolbar builder. We should extract
 that method into separate service
 - SkinMinerva provides getHistoryUrl() method which is used
 both in the skin code and in Toolbar builder. We should provide
 MinervaUrls service that knows how to build custom mobile URLs.

Bug: T221792
Change-Id: Ie08c4b61cea60c3a42fbf796a39360feea22bc33
2019-06-05 21:07:40 +02:00
Piotr Miazga 9d1217e13e PageActions menu elements should be built by using IMenuElement
To simplify and make code reusable all menu elements should be built
by using Builder pattern. This a first step, first we the pageActions
methods should return Group object/IMenuElement objects, then in the
second step we will extract this logic into Director/Builder
classes leaving SkinMinerva class much smaller.

Bug: T221792
Change-Id: Ic51c4ca4139919fc3c5f3ada8b1b2fe5d23031d7
2019-06-05 13:08:33 +02:00
jenkins-bot cb7dfc2dc6 Merge "Untangle watchstar icon" 2019-06-04 22:17:50 +00:00
Piotr Miazga 047618c24d Hygiene: SkinUserPageHelper should support Title = null
In some edge cases the RequestContext::getTitle() can return null
instead of Title object. Similar situations already happened in the
past (see T179833). The RequestContext::getTitle() documentation
says it can return null, therefore code should be resilient and
support such situations, even if there are not common.

Bug: T221792
Change-Id: I842f8c49f20e511fda3b081e59a06586810bc748
2019-06-04 17:17:58 +02:00
Kosta Harlan 1e87c62191 Add hook to override SkinOptions, and allow overriding tabs output
Bug: T222835
Change-Id: I0d390eadbd0a8de7f328360df5c60d9fb2225db1
2019-06-04 10:24:30 -04:00
Jan Drewniak 7af32bc309 Treat anonymouse user IP pages as UserPages
Ensure SkinUserPageHelper::isUserPage() returns true for user pages
that are IP addresses.

Also adds the page-action menu to all user pages.

Bug: T220114
Change-Id: I3703899bc9ff0042c74260d36f48a388b78b0b6b
2019-06-04 11:53:07 +02:00
jenkins-bot 9dd0d21029 Merge "Minerva nav_urls are used only when OverflowMenu is present" 2019-06-03 17:26:03 +00:00
jenkins-bot 4ef947da28 Merge "Watchstar should respect viewmywatchlist|editmywatchlist permissions" 2019-06-03 16:16:58 +00:00
Piotr Miazga 4ec9b06a77 Watchstar should respect viewmywatchlist|editmywatchlist permissions
If viewmywatchlist|editmywatchlist permisions were set to false for
anonymous user, MinervaSkin would show a watchstar icon that links
to LoginPage, even if user was logged in. Clicking watching action
would cause browser to reload the page without any effect.
Under the hood - system would redirect to login, and then the login
page would redirect user back to the article page because user is
logged in.

MinervaSkin should respect viewmywatchlist|editmywatchlist
permissions. If user do not have access to watchlist, do not show
watch icon.

Bug: T221792
Change-Id: I26a1133a7ccff6a4adcdc72d594d0902bfa8ff79
2019-05-31 17:34:35 +00:00
Piotr Miazga 82a2edf585 Untangle watchstar icon
The SkinMinerva::createWatchPageAction() was depending upon
$tpl['content_navigation']['actions'] object, which is created by
SkinTemplate::buildContentNavigationUrls(). Although only 'watch'
and 'unwatch' keys were used, moreover, code was using only 'href'
property from both 'watch' and 'unwatch'. All other props are
overrided, not used when rendering. Also the title of unwatch
icon was set to "watch this page" which was incorrect.

This system was bit complex to manage (we should provide dependencies
not pass the whole 'content_navigation']['actions'] array). It would
also make further refactoring more difficult, as watchstar icon
shouldn't depened on quicktemplate stuff. We were using only href
attribute which is super easy to calculate.

Changes:
 - do not depend upon $actions, get href by using $title->getLocalUrl
 - set proper title for unwatch icon
 - simplified SkinMinerva::createWatchPageAction() logic

Bug: T221792
Change-Id: I9609949b60a7e2f2f0a947c05c80c89be32d4cb1
2019-05-29 17:37:40 +02:00
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 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
jenkins-bot b503d36560 Merge "MinervaNeue doesn't need PersonalUrls" 2019-05-08 18:35:04 +00:00
Piotr Miazga f4fa534b9d Minerva nav_urls are used only when OverflowMenu is present
There is no need to call SkinTemplate::buildNavUrls() as the 'nav_urls'
from QuickTemplate are used only when OverlfowMenu is present. There is
no need to do that heavy calculation unless we really need it.

Change-Id: I003efcdeffe10f6a3a155932a20c09e8f62c747e
2019-05-07 22:42:49 +02: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
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
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 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
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
jdlrobson 577b72a14d Remove backwards compatible CSS
This is no longer needed when Varnish cache has cleared (About a
week from I7e989a3d4553eb3357598a5cad3ccebf51dc9fae being deployed

Bug: T212216
Change-Id: I1afb68f68cc90d89c442907426bd046ddc68f488
2019-02-12 17:40:49 -08:00
jdlrobson e54d7feb06 Talk tabs disabled on main page
Bug: T214724
Change-Id: I0acbfcbbfa333e2d22f6d2caf285ad00ca71b14a
2019-02-12 17:25:56 -08: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
jenkins-bot cbd624d6ab Merge "page actions is no longer position absolute" 2019-02-08 19:22:42 +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
jdlrobson 95b139d756 page actions is no longer position absolute
This was causing lots of problems with the AMC design and seems
unnecessary. It dates back to tablet support added in
I14c8182473c9508ffc38a8d5baf114bcb016a35f in 2014. This no longer
appears to be needed for tablet.

Changing the HTML means we need to be careful about Varnish cached
HTML with new styles. To avoid UI regressions we use a new temporary
class heading-holding--new which will be removed as soon as possible.
The no-page-actions modifier is no longer needed given the new heading
holder doesn't care what's inside it.

Bug: T212216
Change-Id: I7e989a3d4553eb3357598a5cad3ccebf51dc9fae
2019-02-07 12:16:14 -08:00
libraryupgrader 63e52a302a build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: Ie071cb13e535f3fe168bc6cf780b21add90b4b8a
2019-02-07 07:51:12 +00:00
jdlrobson 4d734942c5 Remove large bottom margin at top of main page
Main pages do not have page actions, yet the header always adds
bottom padding to compensate for the fact that page actions are
absolutely positioned.

a new class is added adopting BEM notation that informs the client
that no page actions are going to be visible. In conjuction to this
we strip the relevant HTML from the DOM.

Bug: T212216
Change-Id: Ib69991e91160ba7e2ca3beca4475c2a06c4b9cd3
2019-01-23 12:10:06 -07:00
jdlrobson e34cb9c509 Restore banners to Wikivoyage project
Restore prebodyhtml which was removed in
41b59d4a2b
by mistake in the process wiping out all Wikivoyage banners
on mobile

Change-Id: I6c31363d682ea4a714942fc9f94a9c85e1a8b9d9
2019-01-23 09:02:58 -08: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
jenkins-bot b06a079a81 Merge "Move HTML construction to Minerva template and simplify" 2019-01-15 15:09:01 +00:00
jdlrobson 41b59d4a2b Move HTML construction to Minerva template and simplify
Right now the HTML construction is split between MinervaTemplate
and minerva.mustache

I'd like to move all of this to mustache to make it easier to see
how to make changes.

Additional changes:
* footer-site-heading-html was previously mapped to headinghtml
The template variable has been renamed to avoid confusion.

Change-Id: I1dfe15f6f74b51b152c206e2ea63ae460d704ab6
2019-01-14 15:27:55 -08:00
zoranzoki21 5404c85e86 Fix transcuded typo
Bug: T201491
Change-Id: I705b20bc1fd8bc014c614521dc54de69fc300b26
2019-01-13 13:10:48 +00:00
jdlrobson d8a8410a8d Hygiene: Simplify Nearby menu item registration
The Special:Nearby page is only available if wgMFNearby is
enabled so the first 2 checks are identical.

If the page is enabled, we should be able to assume the
sysop knows what they are doing and avoid all  these
unnecessary checks. It seems foolish to also check the
existence of Geodata or a NearbyEndpoint

Additional change:
* Don't use deprecated SpecialPageFactory. Use the service
instead.

Change-Id: I3a4b8fa55fc7f29c90f7173d1d973d5f4f759a6b
2019-01-04 09:13:19 -08:00
jdlrobson 97fd861a63 page issues is feature flagged
* New feature/skin option is added and value is read inside
the pageIssues setup code
* issues-group-a class is added to page on server side to remove
the flash of unstyled content
* issues-group-A class is dropped (it's not doing anything!)
* The minerva-issues flag will now accept any value to avoid confusion.
It is used to override the default setting of wgMinervaPageIssuesNewTreatment
A note has been added that this can be removed in future.

Bug: T206179
Change-Id: I3d98fd8f8e1adc818ea03589d2c8f68fe991e861
2018-11-20 12:41:41 -08:00
jenkins-bot 5a2cfe3623 Merge "Remove 'skins.minerva.editor' module (moved to MobileFrontend)" 2018-11-14 23:37:31 +00:00
Bjornskjald dc61408a59
Add checking if template should output <sup>β</sup>
Bug: T208185
Change-Id: I4d564d9398947ea650b935b42cf79ef4a36d1b7e
2018-11-14 21:39:26 +01:00
Bartosz Dziewoński b17d3f70da Remove 'skins.minerva.editor' module (moved to MobileFrontend)
Added in MobileFrontend in Iaaed72c32b9c4f4e15c320b79e29e9af3609069a.

(The module's name is included in cached page HTML, so to avoid
breaking them, 'skins.minerva.editor' must temporarily remain as an
alias for 'mobile.editor'. It is otherwise unused and can be removed
after caches expire on Wikimedia wikis.)

Depends-On: Iaaed72c32b9c4f4e15c320b79e29e9af3609069a
Bug: T198765
Change-Id: I52c4e0941dcf8f176e3ac32d8a1f72a0f8e1d6a6
2018-11-13 23:27:29 +01:00
arcayn c64a4cf811 Move canEdit checks to server from client
Bug: T206262
Change-Id: I08bfc56998f4fb42c8ce76cc2ad9fba83106d476
2018-11-09 21:26:49 +00:00
jenkins-bot 69eddce6be Merge "Disable mobile editor (skins.minerva.editor) on desktop" 2018-11-05 22:11:12 +00:00
jdlrobson 6a73c395f1 Don't ship wgMFDescription if you're not using it
There are no occurances in the codebase using this description
so do not include it.

Bug: T186062
Change-Id: Icd06329af2756d3fcd143deab528e6a7c7d56d30
2018-11-01 18:58:49 +00:00
Volker E b4287378fd Provide ARIA label on main search input
Bug: T208290
Change-Id: I594ab47ffcba3596e52f02a751eaed6084db207b
2018-10-29 22:21:27 -07:00
Bartosz Dziewoński d57f8290c3 Disable mobile editor (skins.minerva.editor) on desktop
This module is no longer necessary to allow editing pages in the
Minerva skin. When it is not loaded, the normal desktop editor will
be used instead (that may be WikiEditor, VisualEditor, just the plain
textarea from MediaWiki core, or something else).

Bug: T198765
Bug: T208068
Change-Id: I1eb9d4b4bc937522e527dbdc0d6be82baf3b7413
2018-10-30 03:46:13 +01:00
jenkins-bot 6cf66a2ad8 Merge "Revert "`autocomplete` is not necessary on `search` input types"" 2018-10-30 00:15:05 +00:00
Jdlrobson b71e36313f Revert "`autocomplete` is not necessary on `search` input types"
This reverts commit 05fd384803.

Looks like it is needed.  On android i am now seeing autocomplete unexpectedly...

Change-Id: I9c4476346c183d6dcc9e25965530f3e2478ed88f
2018-10-27 06:03:00 +00:00
jenkins-bot a79a0276bd Merge "Add "Discussion" button to Main page on Mobile View" 2018-10-23 20:18:50 +00:00
jenkins-bot 885092114b Merge "Watchstar is accessible to non-js users" 2018-10-23 20:09:40 +00:00
Alangi Derick a2fd0b3c1f Add "Discussion" button to Main page on Mobile View
* Enable discussion button on main page in mobile view so users
  can view discussion topics related to the main page on mobile.
* Update test to make sure only 'talk' and 'switch-language' actions are
  enabled on the main page and 'edit' and 'watch' are disabled on the main
  page.
* Minor typo fix for doc type. Use "array" instead of "Array" and CSS
  alignment fix issue with Discussion button when displayed together with
  Language selector button.
* [Suggested by: @Jdlrobson] Use a generic "a" CSS selector to style the ".talk"
  and ".language-selector" classes on the main page. This also avoids fixing the
  CSS for future buttons if added (future proofing the code), so if any other
  button is added in the future, the same css rule will be applied to it at once.
  Very wise idea from @Jdlrobson, thanks!

Bug: T206406
Change-Id: Iedce84595adc357f3a707f8b94d23b2ffea3476c
2018-10-23 19:59:22 +01:00
jdlrobson aa6a2dda4c Watchstar is accessible to non-js users
Bug: T196893
Change-Id: I5dbd164ba68e6c74e80f8bcf90819a526cda5a5e
2018-10-19 11:00:19 -07:00
Fomafix 133e806865 Force type Language for $lang of doEditSectionLink
Also make the parameter $tooltip mandatory to ensure that a mandatory
parameter does follow an optional parameter. ParserOutput always fill
all parameters of doEditSectionLink.

Bug: T207413
Depends-On: Ic49d76c7d9357f99b462471696f7e1eb86e70e3d
Change-Id: I49c1e3fb7bf72002c7f498d4afe14a06caf411f8
2018-10-18 22:13:29 +02:00
jenkins-bot 26e29baf8d Merge "Show watchlist to non-JS users of Minerva" 2018-10-15 09:16:01 +00:00
Piotr Miazga 51b6e8209b Add share icon as mobile web beta feature
Add a new beta feature - share icon. When user opts into beta
the share icon will be visible on supported devices (Android OS
and Chrome browser).

Bug: T181195
Change-Id: Ie4b9dd05eea9b63422bd174048d8b1251cb02bf4
2018-10-12 22:08:28 +02:00
jdlrobson cbad0bd363 Merge skin option modules into a single ResourceLoader module and move enabled logic to client
It's presumed that skin options will eventually become the default or be removed from the skin.
While they are not the default, it would be helpful to package them in one single module - as ResourceLoader
modules are costly bloating the dependency graph in the MediaWiki startup module.

In T167713 we talked about grouping our entry points by page rather than feature, which this seems consistent
with. A page with special options enabled is different from a page without.

Change-Id: Id948f913d4743532ba3442d2059a03c122419ff2
2018-10-12 10:18:21 -07:00
jenkins-bot 5d4ad087c1 Merge "Remove code related to no-anonymous-editing mode of MobileFrontend" 2018-10-11 20:27:33 +00:00
jdlrobson 3f674008a3 Show watchlist to non-JS users of Minerva
Bug: T196893
Change-Id: Ibd52079d3862854c9c88dae87501b0d42ae99716
2018-10-10 14:08:59 -07:00
Bartosz Dziewoński cada514ded Remove code related to no-anonymous-editing mode of MobileFrontend
All of this would only be used with the configuration setting
`$wgMFEditorOptions['anonymousEditing'] = false;`.

Removed features:
* Call-to-action popup in skins.minerva.editor (note that anonymous
  editors still get a CTA from MobileFrontend's EditorOverlay code)
* Pointer towards the edit button shown after registering via the CTA
  (entire skins.minerva.newusers module)

Bug: T205382
Change-Id: I66c7035f7a23581811dda87c911dea41d4a8e5da
2018-10-10 19:03:53 +00:00
Volker E 05fd384803 `autocomplete` is not necessary on `search` input types
Attribute doesn't provide any functionality on `type="search"`.

Change-Id: Ibf571b100155defa7188354f85586ea6d31dc720
2018-10-09 03:45:31 +00:00
Bartosz Dziewoński 6b0ce86410 Make Minerva section editing more like other skins
Goal: Make skins.minerva.editor not rely on Minerva-specific markup.

SkinMinerva.php:
* Add `class="mw-editsection"` to section edit links in SkinMinerva.
  This is the default behavior in SkinTemplate.
* Tweak the page "Edit" link generated in PHP to be the same as the
  link we were generating in JS: add class="edit-page" and change the
  message for the text.
* (Fix an unrelated code comment that was incorrect.)

skins.minerva.content.styles/hacks.less:
* Remove a hack that was hiding .mw-editsection, since we now use it.

skins.minerva.editor/init.js:
* Stop using the `data-section` attribute on links to decide which
  page section to open in the editor. Instead, use the `href`
  attribute and extract the `section` URL parameter from it.
* Stop using the `edit-page` class to find section edit links.
  Instead, use the `mw-editsection` class.
* Remove super weird code that removed the original "Edit" link from
  the page and generated an identical one to replace it, instead of
  just adding event handlers to the existing one.
* Centralize event handling for all types of edit links.

Bug: T198765
Change-Id: I79639c738ff1c3ec4b48ee2e462d23060151a21b
2018-10-04 14:07:27 -07:00
jdlrobson 87924e7e25 Add `theme-color` meta tag to Minerva
For non-web-apps we can still control the color of the address and
status bar. Currently this is defined in MobileFrontend)
but is configurable if we ever want to change it. If not defined
(e.g. no MobileFrontend/no config) it is not added.

Bug: T204691
Depends-On: I39c0905f86edc4f52235b905850c31257e7f792e
Change-Id: I3ab0f538fb6ae3332574fd212eea1a7ec6a397bd
2018-10-01 14:25:25 +00:00
Piotr Miazga 71cbed60fb Create $returntoquery variable properly
The $returntoquery variable is created only when request wasn't
posted, but the variable can be accessed on POSTed request.
To fix that issue we need to always define $returntoquery as
an empty array. This is done in order to prevent leak of
any sensitive data sent by POST request.

The sample error from fatalmonitor:
Undefined variable: returntoquery in
skins/MinervaNeue/includes/skins/SkinMinerva.php on line 701

Bug: T205449
Change-Id: I20e5955ddcb99c110a3dc03fb3b56c1904601453
2018-09-26 15:36:44 +02:00
jenkins-bot 5596488f9d Merge "Minerva A/B tests are not subject to HTML caching time" 2018-09-25 09:32:35 +00:00
jdlrobson 58c0b8131f Minerva A/B tests are not subject to HTML caching time
Config added inside SkinMinerva is subject to the rules of HTML
caching and can take several days [1]

Adding it via the onResourceLoaderGetConfigVars hook reduces the
cache time to minutes [2], giving us more control over the experiment's
enabled state.
[1] T124954
[2] https://www.mediawiki.org/wiki/ResourceLoader

Bug: T205355
Change-Id: I18cb40afe405e2f6a89a7ce5a924eb855aed5430
2018-09-24 22:49:34 +00:00
Bartosz Dziewoński 992630c705 Remove broken remains of &campaign=leftNavSignup handling
This code could never be used under normal circumstances since
a crucial bit of it was removed from MobileFrontend in 2015:
(I65e943b6dad8bfea994020f9f555bd095da1a171)

    // Allow us to distinguish sign ups from the left nav to logins.
    // This allows us to show them an edit tutorial when they return to the page.
    if ( $query['returntoquery'] === 'welcome=yes' ) {
    	$query['returntoquery'] = 'campaign=leftNavSignup';
    }

…and honestly, that's for good, because it fails horribly
when triggered by adding &campaign=leftNavSignup to the URL
manually: clicking "Start editing" in the callout navigates
you to an article called "Undefined/leftNavSignup".

Bug: T205325
Change-Id: I0e385488be5b2eaa7d489029b91e18b336c0d133
2018-09-24 19:30:03 +00:00
Bartosz Dziewoński 786ec45c30 SkinMinerva: Remove incorrect comment
'returnto' is, in fact, set a few lines above this comment,
since 2013 (I1553ee71f4f9ffec8462e3f9b85de9f39d921204).

Change-Id: I20ab084b3ddf59d338268f00a7f2306c9e2bd2b3
2018-09-21 19:57:15 +00:00
jenkins-bot ee5959a6fb Merge "Get rid of ICustomizableSkin" 2018-09-21 16:03:47 +00:00
Ed Sanders fd517597aa Add a notifications overlay container to the skin
Bug: T202466
Bug: T202620
Depends-On: I5a78949efef88083bdafc4207a6872c76b463970
Change-Id: I4c05ec666d5cbc93c12c35ab8222871e698f345c
2018-09-06 16:25:19 +00:00
Kunal Mehta 23d21c4ae7 Set explicit output formats to prevent over escaping of messages
Not calling an explicit output format defaults to ->escaped(), which often
leads to double escaping.

Spotted by the phan-taint-check-plugin.

Change-Id: Ie527768bea670808e63cfc8cbff64015ae29d4a3
2018-09-03 22:58:45 -07:00
Zoranzoki21 6d877928f5 Fix common typos in code
Bug: T201491
Change-Id: I1b31983069a45ff6c0493f370596351a407f6a87
2018-08-27 20:54:16 +00:00