jenkins-bot has submitted this change and it was merged.

Change subject: Convert Special:SearchWiki and Special:ViewUserLang to OOUI
......................................................................


Convert Special:SearchWiki and Special:ViewUserLang to OOUI

Also changed the language field on Special:SearchWiki to a combobox
with language code suggestions enabled.

Bug: T131142
Change-Id: I749d7bd650f9b268ad646955fa3cfc433ca97686
---
M SpecialSearchWiki.php
M SpecialViewUserLang.php
2 files changed, 22 insertions(+), 5 deletions(-)

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



diff --git a/SpecialSearchWiki.php b/SpecialSearchWiki.php
index 457a967..3742003 100644
--- a/SpecialSearchWiki.php
+++ b/SpecialSearchWiki.php
@@ -46,7 +46,7 @@
         */
        protected function showForm( $project, $language ) {
                $form = HTMLForm::factory(
-                       'table',
+                       'ooui',
                        [
                                'Project' => [
                                        'type' => 'select',
@@ -57,12 +57,12 @@
                                        'default' => $project,
                                ],
                                'Language' => [
-                                       'type' => 'textwithbutton',
+                                       'type' => 'combobox',
+                                       'options' => 
$this->getLanguageOptions(),
                                        'name' => 'searchlanguage',
                                        'id' => 'wminc-searchlanguage',
                                        'size' => 30,
                                        'label-message' => 
'wminc-searchwiki-inputlanguage',
-                                       'buttondefault' => $this->msg( 
'wminc-searchwiki-go' )->text(),
                                        'default' => $language,
                                ],
                        ],
@@ -70,13 +70,30 @@
                );
                $form->setMethod( 'get' )
                        ->setWrapperLegendMsg( 'wminc-searchwiki' )
-                       ->suppressDefaultSubmit()
+                       ->setSubmitTextMsg( 'wminc-searchwiki-go' )
                        ->setId( 'wminc-searchwiki-form' )
                        ->prepareForm()
                        ->displayForm( false );
        }
 
        /**
+        * Get a list of supported languages for use by the language form field.
+        * Code stolen from SpecialPageLanguage
+        *
+        * @return array
+        */
+       private function getLanguageOptions() {
+               $userLang = $this->getLanguage()->getCode();
+               $languages = Language::fetchLanguageNames( $userLang, 'mwfile' 
);
+               ksort( $languages );
+               $options = [];
+               foreach ( $languages as $code => $name ) {
+                       $options["$code - $name"] = $name;
+               }
+               return $options;
+       }
+
+       /**
         * @param $projectQuery
         * @param $languageQuery
         */
diff --git a/SpecialViewUserLang.php b/SpecialViewUserLang.php
index 28908f8..f911e92 100644
--- a/SpecialViewUserLang.php
+++ b/SpecialViewUserLang.php
@@ -45,7 +45,7 @@
         * @param $target Mixed: user whose language and test wiki we're about 
to look up
         */
        function showForm( $target ) {
-               $form = HTMLForm::factory( 'table',
+               $form = HTMLForm::factory( 'ooui',
                        [ 'Target' => [
                                'type' => 'user',
                                'name' => 'target',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I749d7bd650f9b268ad646955fa3cfc433ca97686
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikimediaIncubator
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Glaisher <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to