jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403111 )

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


Improve div-style form layout

Bring the div display style closer to the table-based
display of Special:Preferences.

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

Approvals:
  MaxSem: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/GlobalPreferencesForm.php 
b/includes/GlobalPreferencesForm.php
index b872421..ede8e20 100644
--- a/includes/GlobalPreferencesForm.php
+++ b/includes/GlobalPreferencesForm.php
@@ -3,6 +3,7 @@
 namespace GlobalPreferences;
 
 use Html;
+use HTMLFormField;
 use IContextSource;
 use MediaWiki\MediaWikiServices;
 use PreferencesForm;
@@ -29,6 +30,27 @@
        }
 
        /**
+        * Override this in order to hide empty labels.
+        * @param array[]|HTMLFormField[] $fields Array of fields (either 
arrays or objects).
+        * @param string $sectionName Identifier for this section.
+        * @param string $fieldsetIDPrefix Prefix for the fieldset of each 
subsection.
+        * @param bool &$hasUserVisibleFields Whether the section had 
user-visible fields.
+        * @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.global-nojs.css 
b/resources/ext.GlobalPreferences.global-nojs.css
index e8a0f78..8b091b9 100644
--- a/resources/ext.GlobalPreferences.global-nojs.css
+++ b/resources/ext.GlobalPreferences.global-nojs.css
@@ -1,7 +1,3 @@
-.mw-htmlform-nolabel .mw-label {
-       display: none;
-}
-
 .mw-globalprefs-global-check .mw-label,
 .mw-globalprefs-global-check label {
        display: none;
@@ -47,6 +43,14 @@
        padding-left: 7%;
 }
 
+div.mw-input,
+div.mw-label {
+       display: table-cell;
+}
+div.mw-label {
+       padding-right: 0.5em;
+}
+
 .mw-globalprefs-global-check {
        font-size: smaller;
        padding-left: 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3eddc49735b93c23605de1c2c73be477a683023
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: Samwilson <s...@samwilson.id.au>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to