jenkins-bot has submitted this change and it was merged.
Change subject: Use an indicator for code samples, fix no-JS mode
......................................................................
Use an indicator for code samples, fix no-JS mode
Use the new 1.25 "page status indicators" to place the code samples
popup instead of absolute CSS. Notably, this fixes the position of it in
the MonoBook skin.
Also split the styles into a separate module and load it through
addModuleStyles, so the .client-nojs styles take effect.
The styles are also added to the ParserOutput object instead of in a
hook.
Finally, this also fixes a bug in RTL where the code sample headings
were using the content language direction instead of the user language.
Bug: T62233
Change-Id: I44333d0a0943ab4c92182552acb82c5d64be2f0b
---
M EventLogging.php
M includes/JsonSchemaContent.php
M includes/JsonSchemaHooks.php
M modules/ext.eventLogging.jsonSchema.css
4 files changed, 17 insertions(+), 15 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/EventLogging.php b/EventLogging.php
index 1e666bb..57d19a4 100644
--- a/EventLogging.php
+++ b/EventLogging.php
@@ -198,12 +198,18 @@
$wgResourceModules[ 'ext.eventLogging.jsonSchema' ] = array(
'scripts' => 'modules/ext.eventLogging.jsonSchema.js',
- 'styles' => 'modules/ext.eventLogging.jsonSchema.css',
'localBasePath' => __DIR__,
'remoteExtPath' => 'EventLogging',
'position' => 'top',
);
+$wgResourceModules[ 'ext.eventLogging.jsonSchema.styles' ] = array(
+ 'styles' => 'modules/ext.eventLogging.jsonSchema.css',
+ 'localBasePath' => __DIR__,
+ 'remoteExtPath' => 'EventLogging',
+ 'position' => 'top',
+);
+
// Hooks
$wgExtensionFunctions[] = 'EventLoggingHooks::onSetup';
diff --git a/includes/JsonSchemaContent.php b/includes/JsonSchemaContent.php
index e8d43fa..c075131 100644
--- a/includes/JsonSchemaContent.php
+++ b/includes/JsonSchemaContent.php
@@ -169,7 +169,9 @@
// The glyph is '< >' from the icon font 'Entypo' (see
../modules).
$html = Xml::tags( 'div', array( 'class' =>
'mw-json-schema-code-glyph' ), '' ) .
Xml::tags( 'div', array( 'class' =>
'mw-json-schema-code-samples' ), $html );
- $out->setText( $html . $out->mText );
+ $out->setIndicator( 'schema-code-samples', $html );
+ $out->addModules( 'ext.eventLogging.jsonSchema' );
+ $out->addModuleStyles(
'ext.eventLogging.jsonSchema.styles' );
}
return $out;
diff --git a/includes/JsonSchemaHooks.php b/includes/JsonSchemaHooks.php
index 1c37580..1ad32ba 100644
--- a/includes/JsonSchemaHooks.php
+++ b/includes/JsonSchemaHooks.php
@@ -77,7 +77,7 @@
}
/**
- * Adds CSS for pretty-printing schema on NS_SCHEMA pages.
+ * Add the revision id as the subtitle on NS_SCHEMA pages.
* @param OutputPage &$out
* @param Skin &$skin
* @return bool
@@ -86,16 +86,12 @@
$title = $out->getTitle();
$revId = $out->getRevisionId();
- if ( $title->inNamespace( NS_SCHEMA ) ) {
- $out->addModules( 'ext.eventLogging.jsonSchema' );
-
- if ( $revId !== null ) {
- $out->addSubtitle( $out->msg(
'eventlogging-revision-id' )
- // We use 'rawParams' rather than
'numParams' to make it
- // easy to copy/paste the value into
code.
- ->rawParams( $revId )
- ->escaped() );
- }
+ if ( $title->inNamespace( NS_SCHEMA ) && $revId !== null ) {
+ $out->addSubtitle( $out->msg(
'eventlogging-revision-id' )
+ // We use 'rawParams' rather than 'numParams'
to make it
+ // easy to copy/paste the value into code.
+ ->rawParams( $revId )
+ ->escaped() );
}
return true;
}
diff --git a/modules/ext.eventLogging.jsonSchema.css
b/modules/ext.eventLogging.jsonSchema.css
index c9ebb76..f7f35df 100644
--- a/modules/ext.eventLogging.jsonSchema.css
+++ b/modules/ext.eventLogging.jsonSchema.css
@@ -16,7 +16,6 @@
padding: 1.4em;
box-shadow: rgba(0, 0, 0, 0.3) 0.3em 0.3em 1em;
right: 0;
- top: 1em;
}
.client-nojs .mw-json-schema-code-glyph {
@@ -28,7 +27,6 @@
font-size: 3em;
background: #f55b65;
color: #fff;
- position: absolute;
right: 0;
top: -.9em;
padding: 0.1em;
--
To view, visit https://gerrit.wikimedia.org/r/246260
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I44333d0a0943ab4c92182552acb82c5d64be2f0b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Nuria <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits