Sumit has uploaded a new change for review.

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

Change subject: WikidataPageBanner minor issues fixed
......................................................................

WikidataPageBanner minor issues fixed

As a followup on Iba7cea63902e67e195f4c2a3484d85cbcdf203b6, the following issues
have been fixed:
1.Version number fixed
2.messages,dependencies removed from style module
3.Functionality to render banner on any namespace added via a config variable

Change-Id: I598deccd368dee31361293e77b8ed59c005a65f2
---
M WikidataPageBanner.php
M includes/WikidataPageBanner.hooks.php
M resources/Resources.php
3 files changed, 8 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner 
refs/changes/61/208961/1

diff --git a/WikidataPageBanner.php b/WikidataPageBanner.php
index 7d655cd..6ecfd0b 100644
--- a/WikidataPageBanner.php
+++ b/WikidataPageBanner.php
@@ -17,7 +17,7 @@
        'description'    => "Render banners on wikivoyage",
        'descriptionmsg' => 'Display pagewide banners on wikivoyage',
        'author'         => array( 'Sumit Asthana' ),
-       'version'        => '0.0.0',
+       'version'        => '0.0.1',
        'url'            => 
'https://www.mediawiki.org/wiki/Extension:WikidataPageBanner',
        'license-name'   => 'GPL-2.0+',
 );
@@ -26,8 +26,10 @@
  * Options:
  *
  * $wgPBImage - static pagebanner image url
+ * $wgBannerNamespace - Namespaces on which to display banner
  */
 $wgPBImageUrl = 
"http://upload.wikimedia.org/wikipedia/commons/a/a0/South_America_Wikivoyage_banner.jpg";;
+$wgBannerNamespaces = array( NS_MAIN );
 
 /* Setup */
 // autoloader
diff --git a/includes/WikidataPageBanner.hooks.php 
b/includes/WikidataPageBanner.hooks.php
index 9584fb4..487d93f 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -7,15 +7,15 @@
         * @return bool
         */
        public static function viewBanner( $article ) {
-               global $wgPBImageUrl;
+               global $wgPBImageUrl, $wgBannerNamespaces;
                $bannerurl = $wgPBImageUrl;
                $title = $article->getTitle();
                $ns = $title->getNamespace();
                // banner only on main namespacem, and not Main Page of wiki
-               if ( $ns == NS_MAIN && !$title->isMainPage() ) {
+               if ( in_array( $ns, $wgBannerNamespaces ) && 
!$title->isMainPage() ) {
                        $banner = Html::openElement( 'div', array( 'class' => 
'noprint' ) ) .
                        Html::openElement( 'div', array( 'class' => 
'ext-wpb-pagebanner',
-                                                                       'style' 
=> 'background-image:url('.$bannerurl.');'
+                                                                       'style' 
=> "background-image:url($bannerurl);"
                                                                )
                                                        ) .
                        Html::openElement( 'div', array( 'class' => 'topbanner' 
) ) .
@@ -43,8 +43,9 @@
         * @return  bool
         */
        public static function loadModules( $out, $parserOutput ) {
+               global $wgBannerNamespaces;
                $title = $out->getTitle();
-               if ( $title->getNamespace() == NS_MAIN && !$title->isMainPage() 
) {
+               if ( in_array( $ns, $wgBannerNamespaces ) && 
!$title->isMainPage() ) {
                        // Setup banner styling, only if main namespace, and 
not Main Page of wiki
                        $out->addModuleStyles( 'ext.WikidataPageBanner' );
                }
diff --git a/resources/Resources.php b/resources/Resources.php
index 44da9f2..018323d 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -28,11 +28,6 @@
        'styles' => array(
                'ext.WikidataPageBanner.styles/ext.WikidataPageBanner.less',
        ),
-       'messages' => array(
-       ),
-       'dependencies' => array(
-       ),
-
        'localBasePath' => __DIR__,
        'remoteExtPath' => 'WikidataPageBanner/resources',
        'targets' => array( 'desktop', 'mobile' ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I598deccd368dee31361293e77b8ed59c005a65f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: master
Gerrit-Owner: Sumit <asthana.sumi...@gmail.com>

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

Reply via email to