Unbreak styles for installer

The installer hardcodes and expects to find a "skin.vector.styles"
module in skin.json, so moving it into a hook broke the styles. Moved it
back into skin.json, and left a comment so future developers don't make
the same mistake.

The responsive code is now a separate module,
"skins.vector.styles.responsive", which is only added to the page output
if VectorResponsive is enabled.

Bug: T106747
Change-Id: I7540b7871531ef650e799f012477cef6cdd32fb7
This commit is contained in:
Kunal Mehta 2015-07-23 17:05:26 -07:00
parent 0eaadb3b14
commit ac43e74cfb
3 changed files with 22 additions and 37 deletions

View file

@ -48,6 +48,7 @@ class SkinVector extends SkinTemplate {
if ( $this->vectorConfig->get( 'VectorResponsive' ) ) {
$out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
$out->addModuleStyles( 'skins.vector.styles.responsive' );
}
// Append CSS which includes IE only behavior fixes for hover support -

View file

@ -1,29 +0,0 @@
<?php
class VectorHooks {
/**
* Register the 'skins.vector.styles' hook. This is temporary until responsive
* mode becomes the default.
*/
public static function onResourceLoaderRegisterModules( ResourceLoader $rl ) {
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'vector' );
$definition = array(
'position' => 'top',
'styles' => array(
'screen.less' => array(
'media' => 'screen',
),
'screen-hd.less' => array(
'media' => 'screen and (min-width: 982px)',
),
),
'localBasePath' => __DIR__,
'remoteSkinPath' => 'Vector'
);
if ( $config->get( 'VectorResponsive' ) ) {
$definition['styles']['responsive.less'] = array( 'media' => 'screen and (max-width: 768px)' );
}
$rl->register( 'skins.vector.styles', $definition );
}
}

View file

@ -23,16 +23,29 @@
},
"AutoloadClasses": {
"SkinVector": "SkinVector.php",
"VectorTemplate": "VectorTemplate.php",
"VectorHooks": "Vector.hooks.php"
"VectorTemplate": "VectorTemplate.php"
},
"Hooks": {
"ResourceLoaderRegisterModules": [
"VectorHooks::onResourceLoaderRegisterModules"
]
},
"@note": "skins.vector.styles module registered via a hook",
"@note": "When modifying skins.vector.styles definition, make sure the installer still works",
"ResourceModules": {
"skins.vector.styles": {
"position": "top",
"styles": {
"screen.less": {
"media": "screen"
},
"screen-hd.less": {
"media": "screen and (min-width: 982px)"
}
}
},
"skins.vector.styles.responsive": {
"position": "top",
"styles": {
"responsive.less": {
"media": "screen and (max-width: 768px)"
}
}
},
"skins.vector.js": {
"scripts": [
"collapsibleTabs.js",