Stop using a suboptimal structure for Vector's variants menu
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 9 Jun 2014 16:55:24 +0000 (18:55 +0200)
committerJdlrobson <jrobson@wikimedia.org>
Mon, 21 Jul 2014 18:22:42 +0000 (18:22 +0000)
One label is enough.

We need to keep the styles and some inline hacks in the HTML for a
while to keep current CSS compatible with old HTML, which is cached in
WMF environment for up to 30 days.

Follow-up to clean up the mess: I2817c6e9eb52ffc785a04bb9d23b0802a553fd45.

Bug: 43406
Change-Id: Idf43d77dccff83ad81db776f3262e0ef12d25c92

skins/Vector/VectorTemplate.php
skins/Vector/components/tabs.less

index bffc65d..191635c 100644 (file)
@@ -411,25 +411,19 @@ class VectorTemplate extends BaseTemplate {
                                                echo ' emptyPortlet';
                                        }
                                        ?>" aria-labelledby="p-variants-label">
-                                               <h3 id="mw-vector-current-variant">
-                                                       <?php
-                                                       foreach ( $this->data['variant_urls'] as $link ) {
-                                                               ?>
-                                                               <?php
-                                                               if ( stripos( $link['attributes'], 'selected' ) !== false ) {
-                                                                       ?>
-                                                                       <?php
-                                                                       echo htmlspecialchars( $link['text'] )
-                                                                       ?>
-                                                               <?php
-                                                               }
-                                                               ?>
-                                                       <?php
+                                               <?php
+                                               // Replace the label with the name of currently chosen variant, if any
+                                               $variantLabel = $this->getMsg( 'variants' )->text();
+                                               foreach ( $this->data['variant_urls'] as $link ) {
+                                                       if ( stripos( $link['attributes'], 'selected' ) !== false ) {
+                                                               $variantLabel = $link['text'];
+                                                               break;
                                                        }
-                                                       ?>
-                                               </h3>
-
-                                               <h3 id="p-variants-label"><span><?php $this->msg( 'variants' ) ?></span><a href="#"></a></h3>
+                                               }
+                                               ?>
+                                               <h3 id="p-variants-label"><span
+                                                       style="display: block;" <?php /* Temporary WMF deployment hack, to be removed before 1.24 release */ ?>
+                                                       ><?php echo htmlspecialchars( $variantLabel ) ?></span><a href="#"></a></h3>
 
                                                <div class="menu">
                                                        <ul>
index 9e39fbb..57fe45f 100644 (file)
@@ -144,6 +144,7 @@ div#mw-head div.vectorMenu h3 {
 }
 
 // The "Variants" menu has a really funny structure
+// Temporary WMF deployment hack, to be removed before 1.24 release
 div#mw-head div.vectorMenu#p-variants {
        #p-variants-label span {
                display: none;