Commit graph

5 commits

Author SHA1 Message Date
Timo Tijhof 529b798198 build: Simplify Grunt configuration
* Remove file pattern whitelist for JSHint and JSCS. Instead,
  use the ignore list (which we need to specify anyway to avoid
  errors when using IDE plugins and/or running these from the
  command-line directly.

* Remove redundant '*.json' pattern for banana. '**/*.json' covers
  this already as '**' is recursive from the current directory,
  otherwise it would be '*/**'.

* Remove redundant 'name' and 'version' property. These were likely
  added to suppress warnings by npm-install. However those warnings
  are intended for packages published to npmjs.org. For local build
  tools, adding private:true also suppress these warnings. For
  extensions, name and versions are already maintained in other files
  such as extension.json and others.

* Remove redundant '$' entry in jshintrc. There's no need to tolerate
  use of global variable '$'. The convention is to use 'jQuery' and
  alias it locally, which this extension already does everywhere.

* Set 'jQuery' to false instead of true in jshint globals. True
  means it allows and expects this package to assign or expose
  the 'jQuery' identifier. However that is not the case. If this
  code overwrites jQuery, that should probably trigger a warning,
  thus set to false, which means read-only global.

Change-Id: I0b159b6d684f67933e0dae506db1eb3800a6f192
2015-11-10 18:07:15 +00:00
Sam Smith 7ebe784fc2 Run JSHint and JSCS against tests
Changes:

* Extend the definition of all JavaScript files to include those in the
  tests directory
* Run JSHint and JSCS against all JavaScript files
* Fix the existing code style errors in the RelatedPagesGateway
  test

Change-Id: Ia6d8fa63e0b86760857d4480a0575b57512fa36b
2015-11-06 22:08:31 +00:00
jdlrobson e86fc3b159 Fall back to CirrusSearch's morelike: feature
When no related articles have been specified by an editor we instead
hit request pages similar to the current page using the CirrusSearch
extension's "morelike:" feature [0].

Changes:
* Config variable introduced RelatedArticlesUseCirrusSearch which allows
you to turn on use of the CirrusSearch API.
* Introduce a RelatedPagesGateway for dealing with making the API call
  and returning consistent results
* Move the "simple" API call for hydrating related pages fetched from
  the wgRelatedArticles configuration variable into RelatedPagesGateway
* Reduce the bootstrap module to just a bootstrap module!

Bug: T116707
Change-Id: Ia0ced1d7ae57c0939d1f5af275aa9d393f1420b1
2015-11-06 10:23:39 -08:00
Sam Smith 7c23636954 Add Related Articles section to Minerva
If the page has related articles, is in mainspace, isn't the main page,
and the output is being rendered with the MinervaBeta skin then a
"Related Articles" section is added to the page just before the footer.

Separate loading the information necessary to render the pages, choosing
the renderer, and rendering the data so that multiple skins - currently
Minerva and Vector per the mocks - not just multiple resolutions can all
be handled the same way:

* The bootstrap script (ext.relatedArticles.readMore.bootstrap/index.js)
  for fetches the page image and Wikidata description; loading the
  renderer module; and, finally, notifying the renderer module that it
  should render the data, which it does by emitting
  "ext.relatedArticles.readMore.init" event using mw#track
* The Minerva renderer subscribes to the event and, when it's fired,
  renders the data by passing it to the WatchstarPageList view

Bug: T113635
Change-Id: I651342bdf9796938fa7051828dd13bc6fe774783
2015-10-26 17:13:46 -07:00
Sam Smith cd055fde89 Add extension boilerplate
Copypasta the following files from the BoilerPlate extension [0]:

* package.json
* Gruntfile.js
* .jscsrc
* .jshintrc
* .jshintignore
* composer.json
* phpcs.xml

Add the following supporting files:

* .gitignore
* composer.lock

Finally, fix the existing coding standard violations.

[0] https://github.com/wikimedia/mediawiki-extensions-BoilerPlate

Change-Id: I30c6cf9e0a637bab5d8f47790b9af57183b6e6fb
2015-10-07 15:48:26 +01:00