Style warnings from live preview on Special:Upload
authorumherirrender <umherirrender_de.wp@web.de>
Wed, 27 Apr 2016 19:48:08 +0000 (21:48 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Wed, 27 Apr 2016 19:48:08 +0000 (21:48 +0200)
The live preview about warnings on Special:Upload does not style
warnings added to the form. Added styles to the container to style the
warnings.
Also reuse the style to give the warning box on the non-js from the same
style. The visual effect here is an expand box to the full width.

Change-Id: I36e0bf0332eac476002569f46ab116f271f3c468

includes/specials/SpecialUpload.php
resources/Resources.php
resources/src/mediawiki.special/mediawiki.special.upload.css [new file with mode: 0644]
resources/src/mediawiki.special/mediawiki.special.upload.js

index 75308aa..09111f6 100644 (file)
@@ -367,8 +367,11 @@ class SpecialUpload extends SpecialPage {
 
                $sessionKey = $this->mUpload->stashSession();
 
+               // Add styles for the warning, reused from the live preview
+               $this->getOutput()->addModuleStyles( 'mediawiki.special.upload' );
+
                $warningHtml = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . "</h2>\n"
-                       . '<div class="warningbox"><ul>';
+                       . '<div class="mw-destfile-warning"><ul>';
                foreach ( $warnings as $warning => $args ) {
                        if ( $warning == 'badfilename' ) {
                                $this->mDesiredDestName = Title::makeTitle( NS_FILE, $args )->getText();
index cb7adbe..be13559 100644 (file)
@@ -1869,6 +1869,7 @@ return [
                        'thumbnail.html' => 'resources/src/mediawiki.special/templates/thumbnail.html',
                ],
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.upload.js',
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.upload.css',
                'messages' => [
                        'widthheight',
                        'size-bytes',
diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.css b/resources/src/mediawiki.special/mediawiki.special.upload.css
new file mode 100644 (file)
index 0000000..b916248
--- /dev/null
@@ -0,0 +1,10 @@
+/*!
+ * Styling for Special:Upload
+ */
+.mw-destfile-warning {
+       border: 1px solid #fde29b;
+       padding: .5em 1em;
+       margin-bottom: 1em;
+       color: #705000;
+       background-color: #fdf1d1;
+}
index 9836403..dd48367 100644 (file)
                },
 
                setWarning: function ( warning ) {
-                       var $warning = $( $.parseHTML( warning ) );
+                       var $warningBox = $( '#wpDestFile-warning' ),
+                               $warning = $( $.parseHTML( warning ) );
                        mw.hook( 'wikipage.content' ).fire( $warning );
-                       $( '#wpDestFile-warning' ).empty().append( $warning );
+                       $warningBox.empty().append( $warning );
 
                        // Set a value in the form indicating that the warning is acknowledged and
                        // doesn't need to be redisplayed post-upload
                        if ( !warning ) {
                                $( '#wpDestFileWarningAck' ).val( '' );
+                               $warningBox.removeAttr( 'class' );
                        } else {
                                $( '#wpDestFileWarningAck' ).val( '1' );
+                               $warningBox.attr( 'class', 'mw-destfile-warning' );
                        }
 
                }