[New gallery] ignore perrow option in this mode, as doesn't make sense.
authorBrian Wolff <bawolff+wn@gmail.com>
Fri, 23 Aug 2013 23:22:06 +0000 (16:22 -0700)
committerBrian Wolff <bawolff+wn@gmail.com>
Fri, 23 Aug 2013 23:24:32 +0000 (16:24 -0700)
gallery in packed resizes images to have same height. Since the images
have dynamic height, its impossible to implement the perrow option
using a width: css rule.

Also fixes the option for the nolines mode, where it calculated
the row length wrong.

Change-Id: I99018e258d3eea93c8203cb0b6bb63bfed1c00b7

includes/gallery/NolinesImageGallery.php
includes/gallery/PackedImageGallery.php

index 9e0a494..6b0d0fa 100644 (file)
@@ -28,7 +28,8 @@ class NolinesImageGallery extends TraditionalImageGallery {
        }
 
        protected function getGBBorders() {
-               return 0;
+               // This accounts for extra space between <li> elements.
+               return 4;
        }
 
        protected function getVPad( $boxHeight, $thumbHeight ) {
index 9149f8c..e042d0f 100644 (file)
 
 class PackedImageGallery extends TraditionalImageGallery {
 
+       function __construct( $mode = 'traditional' ) {
+               parent::__construct( $mode );
+               // Does not support per row option.
+               $this->mPerRow = 0;
+       }
+
        /**
         * We artificially have 1.5 the resolution neccessary so that
         * we can scale it up by that much on the client side, without
@@ -88,4 +94,12 @@ class PackedImageGallery extends TraditionalImageGallery {
        protected function getModules() {
                return array( 'mediawiki.page.gallery' );
        }
+
+       /**
+        * Do not support per-row on packed. It really doesn't work
+        * since the images have varying widths.
+        */
+       public function setPerRow( $num ) {
+               return;
+       }
 }