Commit graph

13 commits

Author SHA1 Message Date
Baha 9c1404ce99 Allow blacklisting skins for showing ReadMore in footer
Introduce a new config variable `RelatedArticlesFooterBlacklistedSkins`
to control skins that are allowed to show ReadMore in the footer.
As before Minerva beta mode is always allowed to show.

Depends-on: I366c8656a0f14a7069053b2e6199caac20471ea4
Depends-on: Ie4ac3c11e81eeea9f5b4a7161a64477cb5d60f07
Bug: T144047
Change-Id: I1663ab25083d9d907f288e60d506831bebb67945
2016-09-26 15:26:03 +00:00
Baha 613ed40d23 Perf: don't load a module unless necessary
Move logic that loads related articles in the footer to PHP from JS.
This prevents us from shipping an RL module to a client and not showing
related articles.

Also, make sure not to load related articles in footer on
Special:MobileDiff.

Bug: T144047
Change-Id: I73e39ee6b1223699cd8ac739902315d163d98c3b
2016-09-26 08:01:07 +01:00
jdlrobson f960e7b651 Remove styles for old Minerva design
This CSS rule exists for Minerva's old footer. Considering Related
pages is currently only in mobile beta and the new footer should go
live before related pages does. The cost of maintaining 2 related
pages Minerva designs is not worth it.

In a follow up patch the read more container class will be reintroduced
to Minerva

Change-Id: I2d5c4e73c0cfa3f1107a0fd195d3e09f4e14ef2a
2016-09-02 11:56:17 -07:00
Jdlrobson 4b53afc983 Don't hit the DB unnecessarily
If $wgRelatedArticlesShowInFooter is false, then we'll still test
whether or not the page is a disambiguation page with the Disambiguator
extension. Unfortunately, DisambiguatorHooks::isDisambiguationPage hits
the DB.

Order the tests in RelatedArticles\FooterHooks::onBeforePageDisplay from
least expensive to most expensive so that the DB is queried only when it
must be.

This version of the patch takes into account namespace.

Bug: T127068
Bug: T144409
Change-Id: Ie6ddaa4e9bd8326c8b84dc400b78e9a4f4d0d78d
2016-08-31 20:13:05 +01:00
Jdlrobson 9e67ef6590 Revert "Don't hit the DB unnecessarily"
We forgot how namespaces work:
Catchable fatal error: Argument 1 passed to RelatedArticles\FooterHooks::isDisambiguationPage() must be an instance of RelatedArticles\Title, Title given in /srv/mediawiki/php-master/extensions/RelatedArticles/includes/FooterHooks.php on line 48

This reverts commit 9ede8913c7.

Change-Id: If0f1481854815c12613771041685c7837a95ec65
2016-08-31 18:57:41 +00:00
Sam Smith 9ede8913c7 Don't hit the DB unnecessarily
If $wgRelatedArticlesShowInFooter is false, then we'll still test
whether or not the page is a disambiguation page with the Disambiguator
extension. Unfortunately, DisambiguatorHooks::isDisambiguationPage hits
the DB.

Order the tests in RelatedArticles\FooterHooks::onBeforePageDisplay from
least expensive to most expensive so that the DB is queried only when it
must be.

Bug: T127068
Change-Id: Ie3e7e410026cf354d831ae3c2134cfc0957eb8db
2016-08-31 09:38:34 +01:00
Baha b486500ba5 Add documentation
Bug: T127068
Change-Id: I5b640f8fe90cb2b07e7e5113e5dff398684c0c68
2016-08-29 15:59:57 -04:00
Sumit Asthana cea66f6cda Disable related articles on disambiguation pages
Uses DisambiguatorHooks to prevent related pages module addition on
disambiguation pages.

Bug: T127068
Change-Id: I166712d7e5df26ad00c725f3e4fe23ec074b3329
2016-08-24 04:12:45 +05:30
Kunal Mehta d8329fdbb1 build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I3de1f2562898b76b56f5e7aa36b61088331ff52c
2016-05-09 16:59:15 -07:00
Baha cfc73ff5c9 Remove the isElementInViewport function
Use mw.viewport.isElementInViewport instead.

Bug: T124317
Change-Id: I621aa4c21d673d8d431bb38ba094271b570ca93c
2016-04-07 12:23:38 -04:00
Baha f4400ec5c9 Fix RelatedPages placement in Monobook
* Load skin specific styles only in that skin;
* Vector styles are default for all skins unless overwritten;
* Allow monobook styles to inherit from vector styles;
* Do not load visual editor related rules in minerva;
* Remove an unused CSS rule.

Bug: T126149
Change-Id: I1e657de7a45fb4812c42ca7b99624b585dc4b7dd
2016-02-23 14:13:09 -05:00
Sam Smith 040314c504 Configure footer and sidebar placements
Changes:
* Rename $wgRelatedArticlesShowReadMore to $wgRelatedArticlesShowInFooter
* Add $wgRelatedArticlesShowInSidebar, which is truthy by default, and
  short circuit the SkinBuildSidebar and SkinTemplateToolboxEnd hook
  handlers if it is falsy

Bug: T119926
Change-Id: Idf04bf3221ba44d7b898160764fbd6ba83561abb
2015-12-02 11:17:54 +00:00
Sam Smith 9157e303d2 [Hygiene] Reorganise hooks to reflect placements
There are two positions where the list of related articles is rendered:
the sidebar, and the the footer. Move the hook handlers related to
rendering the former to RelatedArticles\SidebarHooks and those related
to rendering the latter to RelatedArticles\FooterHooks.

Change-Id: Idde57905d828e63309bfdc360a3a09e64e291304
2015-12-02 11:10:04 +00:00
Renamed from includes/ReadMoreHooks.php (Browse further)