Ricordisamoa has uploaded a new change for review.
https://gerrit.wikimedia.org/r/281923
Change subject: Use select field in Special:ItemByTitle
......................................................................
Use select field in Special:ItemByTitle
Instead of a jQuery-UI-based suggester
Change-Id: Ifcbf53ba69fbf65e05a774a6cf99f3640ff31d79
---
M repo/includes/Specials/SpecialItemByTitle.php
M repo/resources/Resources.php
D repo/resources/wikibase.special/wikibase.special.itemByTitle.js
3 files changed, 4 insertions(+), 55 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/23/281923/1
diff --git a/repo/includes/Specials/SpecialItemByTitle.php
b/repo/includes/Specials/SpecialItemByTitle.php
index 8bbf041..acce95e 100644
--- a/repo/includes/Specials/SpecialItemByTitle.php
+++ b/repo/includes/Specials/SpecialItemByTitle.php
@@ -178,13 +178,14 @@
wfDebugLog( __CLASS__, __FUNCTION__ . ": Site $siteId exists: "
. var_export( $siteExists, true ) );
- $this->getOutput()->addModules( 'wikibase.special.itemByTitle'
);
+ $siteIds = $this->sites->getSites()->getGlobalIdentifiers();
$formDescriptor = array(
'site' => array(
'name' => 'site',
- 'default' => $siteId,
- 'type' => 'text',
+ 'default' => $siteExists ? $siteId : reset(
$siteIds ),
+ 'type' => 'select',
+ 'options' => array_combine( $siteIds, $siteIds
),
'id' => 'wb-itembytitle-sitename',
'size' => 12,
'label-message' =>
'wikibase-itembytitle-lookup-site'
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index e935bbb..c5f8d05 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -142,17 +142,6 @@
),
),
- 'wikibase.special.itemByTitle' => $moduleTemplate + array(
- 'scripts' => array(
-
'wikibase.special/wikibase.special.itemByTitle.js'
- ),
- 'dependencies' => array(
- 'wikibase.sites',
- 'jquery.ui.suggester',
- 'oojs-ui'
- )
- ),
-
);
return array_merge(
diff --git a/repo/resources/wikibase.special/wikibase.special.itemByTitle.js
b/repo/resources/wikibase.special/wikibase.special.itemByTitle.js
deleted file mode 100644
index 2d10b95..0000000
--- a/repo/resources/wikibase.special/wikibase.special.itemByTitle.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * JavaScript for 'wikibase' extension special page 'ItemByTitle'
- *
- * @since 0.1
- *
- * @license GPL-2.0+
- * @author Jens Ohlig
- */
-( function( $, mw, OO, wb ) {
- 'use strict';
-
- $( document ).ready( function() {
- if ( ( mw.config.get( 'wgCanonicalSpecialPageName' ) !==
'ItemByTitle' ) ) {
- return; // not the right special page
- }
-
- // this will build a drop-down for the language selection:
- var sites = wb.sites.getSites(),
- siteList = [];
- for ( var siteId in sites ) {
- if ( sites.hasOwnProperty( siteId ) ) {
- siteList.push( sites[ siteId ].getName() + ' ('
+ siteId + ')' );
- }
- }
-
- var $input = OO.ui.infuse( $( '#wb-itembytitle-sitename' )
).$input;
-
- $input
- .attr( 'autocomplete', 'off' )
- .suggester( { source: siteList } );
- // Hackety hack hack...
- // On submit, replace human readable value like "English (en)"
with actual sitename ("enwiki")
- $( '#wb-itembytitle-form1' ).submit( function() {
- var langID = String( $input.val().replace(
/.*\(|\).*/gi, '' ) );
- if ( wb.sites.getSite( langID ).getId() !== undefined )
{
- $input.val( wb.sites.getSite( langID ).getId()
);
- }
- } );
- } );
-
-} )( jQuery, mediaWiki, OO, wikibase );
--
To view, visit https://gerrit.wikimedia.org/r/281923
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcbf53ba69fbf65e05a774a6cf99f3640ff31d79
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits