[MediaWiki-commits] [Gerrit] mediawiki...GlobalPreferences[master]: Improve div-style form layout

2018-01-10 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...GlobalPreferences[master]: Improve div-style form layout

2018-01-08 Thread Samwilson (Code Review)
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 

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