Eranroz has uploaded a new change for review.

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


Change subject: Allow categorytree with dir
......................................................................

Allow categorytree with dir

This patch allows to assign dir="ltr" or dir="rtl" for categorytree, and it fix 
the following problems:
* "missing space" between category name and number of pages in category, when 
playing with direction.
  fixed by moving the direction mark after the space
* proper indentation for CategoryTreeChildren
  CategoryTreeChildren class is still in use, but only for JS manipulations, 
and there are now
  CategoryTreeChildren-rtl/ltr classes
  The assignment of direction for CategoryTreeChildren was due to bug 28349
  as far as I checked this isn't nessecry anymore since there is explicit 
adding of direction
  near the count

Change-Id: I9f64beac05995600a27025bf2f98ed3c1476b27e
---
M CategoryTree.php
M CategoryTreeFunctions.php
M modules/ext.categoryTree.css
3 files changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryTree 
refs/changes/12/108012/1

diff --git a/CategoryTree.php b/CategoryTree.php
index 5d0bbdf..85b4cf9 100644
--- a/CategoryTree.php
+++ b/CategoryTree.php
@@ -73,6 +73,7 @@
 $wgCategoryTreeDefaultOptions['hideprefix'] = null; # will be set to 
$wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk
 $wgCategoryTreeDefaultOptions['showcount'] = false;
 $wgCategoryTreeDefaultOptions['namespaces'] = false; # false means "no filter"
+$wgCategoryTreeDefaultOptions['dir'] = null;
 
 $wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES;
 $wgCategoryTreeCategoryPageOptions = array(); # Options to be used for 
category pages
diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php
index f26c91a..847ac1a 100644
--- a/CategoryTreeFunctions.php
+++ b/CategoryTreeFunctions.php
@@ -24,7 +24,7 @@
         * @param $ajax bool
         */
        function __construct( $options, $ajax = false ) {
-               global $wgCategoryTreeDefaultOptions;
+               global $wgCategoryTreeDefaultOptions, $wgLang;
 
                $this->mIsAjaxRequest = $ajax;
 
@@ -47,6 +47,9 @@
                $this->mOptions['showcount']  = self::decodeBoolean( 
$this->mOptions['showcount'] );
                $this->mOptions['namespaces']  = self::decodeNamespaces( 
$this->mOptions['namespaces'] );
 
+               if ( $this->mOptions['dir'] !== 'ltr' && $this->mOptions['dir'] 
!=='rtl' ) {
+                       $this->mOptions['dir'] = $wgLang->getDir();
+               }
                if ( $this->mOptions['namespaces'] ) {
                        # automatically adjust mode to match namespace filter
                        if ( sizeof( $this->mOptions['namespaces'] ) === 1
@@ -777,7 +780,7 @@
                                'dir' => $wgLang->getDir() # numbers and commas 
get messed up in a mixed dir env
                        );
 
-                       $s .= $wgContLang->getDirMark() . ' ';
+                       $s .= ' ' . $wgContLang->getDirMark();
 
                        # Create a list of category members with only non-zero 
member counts
                        $memberNums = array();
@@ -810,10 +813,11 @@
 
                $s .= Xml::closeElement( 'div' );
                $s .= "\n\t\t";
+               $dir = $this->getOption( 'dir' );
                $s .= Xml::openElement(
                        'div',
                        array(
-                               'class' => 'CategoryTreeChildren',
+                               'class' => 'CategoryTreeChildren 
CategoryTreeChildren-' . $dir,
                                'style' => $children > 0 ? "display:block" : 
"display:none"
                        )
                );
diff --git a/modules/ext.categoryTree.css b/modules/ext.categoryTree.css
index 21192ee..688533a 100644
--- a/modules/ext.categoryTree.css
+++ b/modules/ext.categoryTree.css
@@ -23,8 +23,14 @@
         padding: 0.25em 0;
 }
 
-.CategoryTreeChildren {
+
+/* @noflip */ .CategoryTreeChildren-ltr {
        margin-left: 1.25em;
+}
+
+
+/* @noflip */ .CategoryTreeChildren-rtl {
+       margin-right: 1.25em;
 }
 
 .CategoryTreeBullet {
@@ -84,6 +90,6 @@
        *display: inline;
 }
 
-.CategoryTreeSection {
+.CategoryTreeNotice {
        direction: ltr;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f64beac05995600a27025bf2f98ed3c1476b27e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CategoryTree
Gerrit-Branch: master
Gerrit-Owner: Eranroz <eranro...@gmail.com>

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

Reply via email to