Brian Wolff has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/329645 )

Change subject: Use <body> class to set theme for CollaborationHub edit page.
......................................................................

Use <body> class to set theme for CollaborationHub edit page.

Possibly we should do something similar on normal page view(?)

Fixes issue with misnested </form> tag breaking the collapsible
footer js

Change-Id: I1b1330a257ba8365864c168917f689cf47a97a48
---
M extension.json
M includes/CollaborationHubContentEditor.php
2 files changed, 26 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/45/329645/1

diff --git a/extension.json b/extension.json
index 1396ad9..0d2401d 100644
--- a/extension.json
+++ b/extension.json
@@ -75,6 +75,9 @@
                ],
                "OutputPageParserOutput": [
                        "CollaborationKitHooks::onOutputPageParserOutput"
+               ],
+               "OutputPageBodyAttributes": [
+                       "CollaborationHubContentEditor::setCollabkitTheme"
                ]
        },
        "@fixme": "Does having ext.CollaborationKit.list.styles as a dependency 
double load from addModuleStyles?",
diff --git a/includes/CollaborationHubContentEditor.php 
b/includes/CollaborationHubContentEditor.php
index f80de23..3dad151 100644
--- a/includes/CollaborationHubContentEditor.php
+++ b/includes/CollaborationHubContentEditor.php
@@ -117,9 +117,30 @@
                $out = RequestContext::getMain()->getOutput();
 
                $partFields = $this->getFormFields( $parts );
+               // See setCollabkitTheme for how the setProperty works.
+               $out->setProperty( 'collabkit-theme', $this->colour );
                $out->addHtml( Html::rawElement( 'div', [ 'class' => 
'mw-collabkit-modifiededitform' ], $partFields ) );
-               $out->prependHtml( Html::openElement( 'div', [ 'class' => 
'mw-ck-theme-' . $this->colour ] ) );
-               $out->addHtml( Html::closeElement( 'div' ) );
+       }
+
+       /**
+        * Hook handler for OutputPageBodyAttributes.
+        *
+        * Used to set the color theme for Hub edit pages.
+        *
+        * @param OutputPage $out
+        * @param Skin $sk
+        * @param array $bodyAttribs Attributes for the <body> element
+        */
+       public static function setCollabkitTheme( OutputPage $out, $skin, 
&$bodyAttribs ) {
+               $theme = $out->getProperty( 'collabkit-theme' );
+               if ( $theme ) {
+                       $themeClass = 'mw-ck-theme-' . $theme;
+                       if ( !isset( $bodyAttribs['class'] ) ) {
+                               $bodyAttribs['class'] = $themeClass;
+                       } else {
+                               $bodyAttribs['class'] .= ' ' . $themeClass;
+                       }
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/329645
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b1330a257ba8365864c168917f689cf47a97a48
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to