Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/211131
Change subject: Use HTMLForm for Special:Watchlist in preparation of MediaWiki UI ...................................................................... Use HTMLForm for Special:Watchlist in preparation of MediaWiki UI * Use HTMLForm for Namespace selection * Add support for checkbox-inline in MediaWikiUI Bug: T99256 Change-Id: I47a8649208279a4090623a3088112fcff9abc4d3 --- M includes/htmlform/HTMLCheckField.php M includes/htmlform/HTMLFormField.php M includes/specials/SpecialWatchlist.php M resources/src/mediawiki.ui/components/checkbox.less 4 files changed, 55 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/31/211131/1 diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index 4943113..c893ca1 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -14,7 +14,7 @@ $attr = $this->getTooltipAndAccessKey(); $attr['id'] = $this->mID; - $attr += $this->getAttributes( array( 'disabled', 'tabindex' ) ); + $attr += $this->getAttributes( array( 'disabled', 'tabindex', 'title' ) ); if ( $this->mClass !== '' ) { $attr['class'] = $this->mClass; @@ -25,9 +25,13 @@ . Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel ); if ( $wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm ) { + $class = ''; + if ( $this->mParams['isMixin'] ) { + $class = ' mw-ui-input-inline'; + } $chkLabel = Html::rawElement( 'div', - array( 'class' => 'mw-ui-checkbox' ), + array( 'class' => 'mw-ui-checkbox' . $class ), $chkLabel ); } diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 68b6db7..5f0aa3e 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -49,6 +49,7 @@ $mixins = $this->mParams['mixins']; if ( is_array( $mixins ) ) { foreach ( $mixins as $fieldname => $info ) { + $info['isMixin'] = true; $field = HTMLForm::loadInputFromParameters( $fieldname, $info, $this->mParams['parent'] ); $inputHtml .= ' ' . $field->getInputHTML( $info['default'] ); } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index df9d363..7aee40d 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -395,6 +395,7 @@ */ public function doHeader( $opts, $numRows ) { $user = $this->getUser(); + $out = $this->getOutput(); $this->getOutput()->addSubtitle( $this->msg( 'watchlistfor2', $user->getName() ) @@ -449,39 +450,52 @@ $form .= $wlInfo; $form .= $cutofflinks; $form .= $lang->pipeList( $links ) . "\n"; - $form .= "<hr />\n<p>"; - $form .= Html::namespaceSelector( - array( - 'selected' => $opts['namespace'], - 'all' => '', - 'label' => $this->msg( 'namespace' )->text() - ), array( + $form .= "<hr />\n"; + $out->addHtml( $form ); + + $formDescriptor = array( + 'namespace' => array( 'name' => 'namespace', + 'cssclass' => 'namespaceselector', + 'type' => 'namespaceselect', 'id' => 'namespace', - 'class' => 'namespaceselector', - ) - ) . ' '; - $form .= Xml::checkLabel( - $this->msg( 'invert' )->text(), - 'invert', - 'nsinvert', - $opts['invert'], - array( 'title' => $this->msg( 'tooltip-invert' )->text() ) - ) . ' '; - $form .= Xml::checkLabel( - $this->msg( 'namespace_association' )->text(), - 'associated', - 'nsassociated', - $opts['associated'], - array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() ) - ) . ' '; - $form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "</p>\n"; - foreach ( $hiddenFields as $key => $value ) { - $form .= Html::hidden( $key, $value ) . "\n"; - } + 'default' => $opts['namespace'], + 'all' => '', + 'label-message' => 'namespace', + 'mixins' => array( + 'invert' => array( + 'type' => 'check', + 'label' => $this->msg( 'invert' )->text(), + 'name' => 'invert', + 'id' => 'nsinvert', + 'default' => $opts['invert'], + 'title' => $this->msg( 'tooltip-invert' )->text(), + ), + 'associated' => array( + 'type' => 'check', + 'label' => $this->msg( 'namespace_association' )->text(), + 'name' => 'associated', + 'id' => 'nsassociated', + 'default' => $opts['associated'], + 'title' => $this->msg( 'tooltip-namespace_association' )->text(), + ), + 'allpagessubmit' => array( + 'type' => 'submit', + 'default' => $this->msg( 'allpagessubmit' )->text(), + 'name' => 'allpagessubmit', + ), + ), + ), + ); + $htmlForm = HTMLForm::factory( 'inline', $formDescriptor, $this->getContext() ); + $htmlForm->suppressDefaultSubmit(); + $htmlForm->addHiddenFields( $hiddenFields ); + $htmlForm->prepareForm()->displayForm( false ); + + $form = ''; $form .= Xml::closeElement( 'fieldset' ) . "\n"; $form .= Xml::closeElement( 'form' ) . "\n"; - $this->getOutput()->addHTML( $form ); + $out->addHtml( $form ); $this->setBottomText( $opts ); } diff --git a/resources/src/mediawiki.ui/components/checkbox.less b/resources/src/mediawiki.ui/components/checkbox.less index 4829f5f..2022ef6 100644 --- a/resources/src/mediawiki.ui/components/checkbox.less +++ b/resources/src/mediawiki.ui/components/checkbox.less @@ -50,6 +50,11 @@ vertical-align: middle; } + // set display to inline + &.mw-ui-input-inline { + display: inline-table; + } + input[type="checkbox"] { // we hide the input element as instead we will style the label that follows // we use opacity so that VoiceOver software can still identify it -- To view, visit https://gerrit.wikimedia.org/r/211131 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I47a8649208279a4090623a3088112fcff9abc4d3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits