Bmansurov has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366315 )

Change subject: Add print logo
......................................................................

Add print logo

Logo is displayed as a background image. It won't be visible in print
unless the user prints backgrounds too.

An alternative approach will be uploaded in a follow up patch.

Bug: T169826
Change-Id: If8f9f8d95fd3c955ece37d6c8ab6995596189667
---
M Hooks.php
M print.less
M skin.json
3 files changed, 32 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Vector 
refs/changes/15/366315/1

diff --git a/Hooks.php b/Hooks.php
index 82121d3..8aa31c0 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -26,4 +26,21 @@
                        $sk->enableResponsiveMode();
                }
        }
+
+       /**
+        * ResourceLoaderGetLessVars hook handler
+        *
+        * Add variables that belong to the print logo.
+        *
+        * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetLessVars
+        * @param array &$lessVars Variables already added
+        */
+       public static function onResourceLoaderGetLessVars( &$lessVars ) {
+               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'vector' );
+               $printLogo = $config->get( 'VectorPrintLogo' );
+               $lessVars[ 'wgVectorPrintLogoUrl' ] = "'{$printLogo['url']}'";
+               $lessVars[ 'wgVectorPrintLogoWidth' ] = $printLogo['width'];
+               $lessVars[ 'wgVectorPrintLogoHeight' ] = $printLogo['height'];
+       }
+
 }
diff --git a/print.less b/print.less
index b66c1d0..0e46e35 100644
--- a/print.less
+++ b/print.less
@@ -14,10 +14,15 @@
                }
 
                .firstHeading {
+                       background-image: url( @wgVectorPrintLogoUrl );
+                       background-position: right bottom 10px;
+                       background-repeat: no-repeat;
+                       background-size: ~"@{wgVectorPrintLogoWidth}px" 
~"@{wgVectorPrintLogoHeight}px";
                        font-size: 25pt;
                        line-height: 28pt;
                        margin-bottom: 20px;
                        padding-bottom: 5px;
+                       padding-right: ~"@{wgVectorPrintLogoWidth}px";
                }
 
                // Headings
diff --git a/skin.json b/skin.json
index b96f87c..b9a8603 100644
--- a/skin.json
+++ b/skin.json
@@ -32,6 +32,9 @@
        "Hooks": {
                "BeforePageDisplayMobile": [
                        "VectorHooks::onBeforePageDisplayMobile"
+               ],
+               "ResourceLoaderGetLessVars": [
+                       "VectorHooks::onResourceLoaderGetLessVars"
                ]
        },
        "@note": "When modifying skins.vector.styles definition, make sure the 
installer still works",
@@ -110,7 +113,13 @@
                "VectorUseIconWatch": true,
                "@VectorExperimentalPrintStyles": "Temporary config variable to 
feature flag new print styles (T154965)",
                "VectorExperimentalPrintStyles": false,
-               "VectorResponsive": false
+               "VectorResponsive": false,
+               "@VectorPrintLogo": "Logo used in print styles. The object must 
have valid `url` (string), `width` (number in px), and `height` (number in px) 
fields.",
+               "VectorPrintLogo": {
+                       "url": "",
+                       "width": 0,
+                       "height": 0
+               }
        },
        "manifest_version": 1
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8f9f8d95fd3c955ece37d6c8ab6995596189667
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Vector
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to