resourceloader: Add support for delivering templates
authorjdlrobson <jdlrobson@gmail.com>
Fri, 10 Oct 2014 00:07:14 +0000 (17:07 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 29 Oct 2014 19:31:16 +0000 (19:31 +0000)
commitebeb2972360516dff6b734079dc1c8cc0d3bd390
tree55aa08c92b3ab4e5a20d2cc3c298f50dc10746d6
parent79168e0f8b0d20d2ffdfbbb51d1acf42ecea05a4
resourceloader: Add support for delivering templates

A base ResourceLoaderModule::getTemplates() exists for subclasses
to override. An implementation is provided for ResourceLoaderFileModule.

For file modules, templates can be specified in the following manner:

'example' => array(
'templates' => array(
'bar' => 'templates/foo.html',
),
'scripts' => 'example.js',
),

The delivery system is template language agnostic, and currently
only supports "compiling" plain HTML templates.

This also adds template support to the following modules as a POC:
* mediawiki.feedback
* mediawiki.action.view.postEdit
* mediawiki.special.upload

Works with $wgResourceLoaderStorageEnabled

Change-Id: Ia0c5c8ec960aa6dff12c9626cee41ae9a3286b76
20 files changed:
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php
maintenance/jsduck/categories.json
resources/Resources.php
resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
resources/src/mediawiki.action/templates/postEdit.html [new file with mode: 0644]
resources/src/mediawiki.special/mediawiki.special.upload.js
resources/src/mediawiki.special/templates/thumbnail.html [new file with mode: 0644]
resources/src/mediawiki/mediawiki.feedback.js
resources/src/mediawiki/mediawiki.js
resources/src/mediawiki/mediawiki.template.js [new file with mode: 0644]
resources/src/mediawiki/templates/dialog.html [new file with mode: 0644]
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php
tests/phpunit/includes/resourceloader/templates/template.html [new file with mode: 0644]
tests/phpunit/includes/resourceloader/templates/template2.html [new file with mode: 0644]
tests/phpunit/includes/resourceloader/templates/template_awesome.handlebars [new file with mode: 0644]
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/mediawiki/mediawiki.template.test.js [new file with mode: 0644]