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

Change subject: Added language suggestions to SpecialEntitiesWithout*
......................................................................


Added language suggestions to SpecialEntitiesWithout*

Implements language suggestions mechanism analog to ItemDisambiguation special 
page.

Change-Id: Iefc247a186d22477063014a107a61f86dd86f95b
---
M repo/includes/specials/SpecialEntitiesWithoutPage.php
M repo/resources/Resources.php
A repo/resources/wikibase.special/wikibase.special.entitiesWithout.js
3 files changed, 45 insertions(+), 0 deletions(-)

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



diff --git a/repo/includes/specials/SpecialEntitiesWithoutPage.php 
b/repo/includes/specials/SpecialEntitiesWithoutPage.php
index 278fc56..14ec77e 100644
--- a/repo/includes/specials/SpecialEntitiesWithoutPage.php
+++ b/repo/includes/specials/SpecialEntitiesWithoutPage.php
@@ -134,6 +134,8 @@
                        $typeSelect->addOption( $this->msg( 'wikibase-entity-' 
. $type )->text(), $type );
                }
 
+               $this->getOutput()->addModules( 
'wikibase.special.entitiesWithout' );
+
                $this->getOutput()->addHTML(
                        Html::openElement(
                                'form',
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index d5ff81c..79531c8 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -77,6 +77,16 @@
                        )
                ),
 
+               'wikibase.special.entitiesWithout' => $moduleTemplate + array(
+                       'scripts' => array(
+                               
'wikibase.special/wikibase.special.entitiesWithout.js'
+                       ),
+                       'dependencies' => array(
+                               'wikibase.special',
+                               'jquery.ui.suggester'
+                       )
+               ),
+
                'wikibase.special.itemByTitle' => $moduleTemplate + array(
                        'scripts' => array(
                                
'wikibase.special/wikibase.special.itemByTitle.js'
@@ -100,6 +110,7 @@
 
        if ( defined( 'ULS_VERSION' ) ) {
                
$modules['wikibase.special.itemDisambiguation']['dependencies'][] = 
'jquery.uls.data';
+               $modules['wikibase.special.entitiesWithout']['dependencies'][] 
= 'jquery.uls.data';
        }
 
        return $modules;
diff --git 
a/repo/resources/wikibase.special/wikibase.special.entitiesWithout.js 
b/repo/resources/wikibase.special/wikibase.special.entitiesWithout.js
new file mode 100644
index 0000000..1c706bb
--- /dev/null
+++ b/repo/resources/wikibase.special/wikibase.special.entitiesWithout.js
@@ -0,0 +1,32 @@
+/**
+ * JavaScript for 'wikibase' extension special page 'EntitiesWithout*'
+ *
+ * @licence GNU GPL v2+
+ */
+( function( $ ) {
+       'use strict';
+
+       $( document ).ready( function() {
+               var languages = [];
+
+               if( $.uls ) {
+                       $.each( $.uls.data.getAutonyms(), function( key, value 
) {
+                               languages.push( {
+                                       label: value + ' (' + key + ')',
+                                       value: value + ' (' + key + ')'
+                               } );
+                       } );
+               }
+
+               var $languageSelector = $( '#wb-entitieswithoutpage-language' );
+               $languageSelector.suggester( { source: languages } );
+
+               $( '#wb-entitieswithoutpage-form' ).submit( function() {
+                       // Replace human readable value like "English (en)" 
with actual language name ("en"):
+                       var languageCode = String( 
$languageSelector.val().replace( /.*\(|\).*/gi, '' ) );
+                       $languageSelector.val( languageCode );
+               } );
+
+       } );
+
+} )( jQuery );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefc247a186d22477063014a107a61f86dd86f95b
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Lbenedix <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Bene <[email protected]>
Gerrit-Reviewer: Henning Snater <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Lbenedix <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to