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

Change subject: Improve div-style form layout
......................................................................

Improve div-style form layout

Bug: T179738
Change-Id: Ic3eddc49735b93c23605de1c2c73be477a683023
---
M includes/GlobalPreferencesForm.php
M resources/ext.GlobalPreferences.special.css
2 files changed, 30 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences 
refs/changes/11/403111/1

diff --git a/includes/GlobalPreferencesForm.php 
b/includes/GlobalPreferencesForm.php
index 5c36867..1aee82f 100644
--- a/includes/GlobalPreferencesForm.php
+++ b/includes/GlobalPreferencesForm.php
@@ -3,6 +3,7 @@
 namespace GlobalPreferences;
 
 use Html;
+use HTMLFormField;
 use IContextSource;
 use PreferencesForm;
 
@@ -28,6 +29,27 @@
        }
 
        /**
+        * Override this in order to hide empty labels.
+        * @param array[]|HTMLFormField[] $fields
+        * @param string $sectionName
+        * @param string $fieldsetIDPrefix
+        * @param bool $hasUserVisibleFields
+        * @return string
+        */
+       public function displaySection(
+               $fields, $sectionName = '', $fieldsetIDPrefix = '', 
&$hasUserVisibleFields = false
+       ) {
+               foreach ( $fields as $key => $value ) {
+                       if ( $value instanceof HTMLFormField ) {
+                               $value->setShowEmptyLabel( false );
+                       }
+               }
+               return parent::displaySection(
+                       $fields, $sectionName, $fieldsetIDPrefix, 
$hasUserVisibleFields
+               );
+       }
+
+       /**
         * Get the whole body of the form, adding the global preferences header 
text to the top of each
         * section. Javascript will later add the 'select all' checkbox to this 
header.
         * @return string
diff --git a/resources/ext.GlobalPreferences.special.css 
b/resources/ext.GlobalPreferences.special.css
index 4d42ba8..fa204d7 100644
--- a/resources/ext.GlobalPreferences.special.css
+++ b/resources/ext.GlobalPreferences.special.css
@@ -2,6 +2,14 @@
        background-color: #eaecf0;
 }
 
+div.mw-input,
+div.mw-label {
+       display: inline-block;
+}
+div.mw-label {
+       padding-right: 0.5em;
+}
+
 /* Style fixes for Skin:Vector. The ID selector is whitelisted in .stylelintrc 
because Vector uses it. */
 body.skin-vector #preferences fieldset.ext-globalpreferences-select-all {
        padding-bottom: 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3eddc49735b93c23605de1c2c73be477a683023
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: Samwilson <s...@samwilson.id.au>

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

Reply via email to