Merge "Add config option to disable Readability survery & minor fixes"

This commit is contained in:
jenkins-bot 2023-10-17 00:29:18 +00:00 committed by Gerrit Code Review
commit 23aae68630
5 changed files with 47 additions and 17 deletions

View file

@ -283,7 +283,17 @@ final class Constants {
/**
* @var string
*/
public const REQUIREMENT_TYPOGRAPHY_SURVEY = 'TypographySurvey';
public const REQUIREMENT_TYPOGRAPHY_SURVEY_PREFERENCE = 'TypographySurvey';
/**
* @var string
*/
public const REQUIREMENT_TYPOGRAPHY_SURVEY_CONFIG = 'TypographySurveyConfigRequirement';
/**
* @var string
*/
public const TYPOGRAPHY_SURVEY_CONFIG_KEY = 'VectorTypographySurvey';
/**
* @var string

View file

@ -331,17 +331,26 @@ return [
$context->getUser(),
$services->getUserOptionsLookup(),
Constants::PREF_KEY_TYPOGRAPHY_SURVEY,
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY,
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY_PREFERENCE,
$request,
$context->getTitle()
)
);
$featureManager->registerRequirement(
new DynamicConfigRequirement(
$services->getMainConfig(),
Constants::TYPOGRAPHY_SURVEY_CONFIG_KEY,
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY_CONFIG
)
);
$featureManager->registerFeature(
Constants::FEATURE_TYPOGRAPHY_SURVEY,
[
Constants::REQUIREMENT_FULLY_INITIALISED,
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY_PREFERENCE,
Constants::REQUIREMENT_TYPOGRAPHY_SURVEY_CONFIG
]
);

View file

@ -5,15 +5,15 @@
</summary>
<p v-i18n-html:vector-readability-survey-description></p>
<div class="reading-survey__options">
<label>Font size:</label>
<label>{{ $i18n( 'vector-readability-survey-fontSize' ).text() }}</label>
<input v-model="fontSize" type="range" min="12" max="24">
<span> {{ fontSize }} </span>
<label>Line height:</label>
<label>{{ $i18n( 'vector-readability-survey-lineHeight' ).text() }}</label>
<input v-model="lineHeight" type="range" min="16" max="42" step="1">
<span> {{ lineHeight }} </span>
<label>Paragraph spacing:</label>
<label>{{ $i18n( 'vector-readability-survey-paragraphSpacing' ).text() }}</label>
<input v-model="verticalMargins" type="range" min="6" max="36" step="1">
<span> {{ verticalMargins }} </span>
</div>

View file

@ -1,12 +1,16 @@
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
mw.loader.using( [ 'vue' ] ).then( function () {
const Vue = require( 'vue' ),
App = require( './TypographySurvey.vue' ),
mountEl = document.createElement( 'div' );
( function () {
const isMainNamespace = mw.config.get( 'wgNamespaceNumber' ) === 0;
mountEl.id = 'vector-typography-survey';
document.body.appendChild( mountEl );
// @ts-ignore
Vue.createMwApp( App ).mount( mountEl );
} );
}
if ( isMainNamespace ) {
mw.loader.using( [ 'vue' ] ).then( function () {
const Vue = require( 'vue' ),
App = require( './TypographySurvey.vue' ),
mountEl = document.createElement( 'div' );
mountEl.id = 'vector-typography-survey';
document.body.appendChild( mountEl );
// @ts-ignore
Vue.createMwApp( App ).mount( mountEl );
} );
}
}() );

View file

@ -659,6 +659,13 @@
"logged_out": false
},
"description": "@var boolean Temporary feature flag that enables the zebra design for the Vector skin."
},
"VectorTypographySurvey": {
"value": {
"logged_in": false,
"logged_out": false
},
"description": "@var boolean Temporary feature flag to enable a survey tool to gather feedback for typography changes in Vector. Note the user preference `vector-typography-survey` must also be set for the tool to be displayed."
}
},
"ServiceWiringFiles": [