Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/246260

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.

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging 
refs/changes/60/246260/1

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' ), '&#xe714;' ) .
                                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: newchange
Gerrit-Change-Id: I44333d0a0943ab4c92182552acb82c5d64be2f0b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to