Tobias Gritschacher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/109918

Change subject: Register experts for URL and commons in Wikibase
......................................................................

Register experts for URL and commons in Wikibase

This should fix the issue with not linking URL and commons values.
This is temporary and will be refactored in ValueView 0.2.

Change-Id: I0d5d0b75ea52bfeb8fd4dcb1fc3033e94c1c9b61
---
M lib/resources/Resources.php
M lib/resources/wikibase.dataTypes/wikibase.dataTypes.js
2 files changed, 25 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/18/109918/1

diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index 5bed53a..cbb2787 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -129,6 +129,10 @@
                                'wikibase',
                                'dataTypes',
                                'mw.config.values.wbDataTypes',
+                               'mw.ext.valueView',
+                               'jquery.valueview.experts',
+                               'jquery.valueview.experts.urltype',
+                               'jquery.valueview.experts.commonsmediatype',
                        ),
                ),
 
diff --git a/lib/resources/wikibase.dataTypes/wikibase.dataTypes.js 
b/lib/resources/wikibase.dataTypes/wikibase.dataTypes.js
index e601604..cf181e5 100644
--- a/lib/resources/wikibase.dataTypes/wikibase.dataTypes.js
+++ b/lib/resources/wikibase.dataTypes/wikibase.dataTypes.js
@@ -3,7 +3,7 @@
  * @licence GNU GPL v2+
  * @author Daniel Werner < daniel.wer...@wikimedia.de >
  */
-wikibase.dataTypes = ( function( $, mediaWiki, dataTypes ) {
+wikibase.dataTypes = ( function( $, mediaWiki, dataTypes, vv ) {
        'use strict';
 
        var dataTypeDefinitions = mediaWiki.config.get( 'wbDataTypes' ) || {};
@@ -12,10 +12,29 @@
                dataTypes.registerDataType( dataTypes.DataType.newFromJSON( 
dtTypeId, dtDefinition ) );
        } );
 
+               // Experts for values for certain data types:
+       // Those data types might not be defined, so check for them first.
+       var commonsMediaType = dataTypes.getDataType( 'commonsMedia' );
+       if( commonsMediaType ) {
+       //if( commonsMediaType ) {
+               vv.prototype.options.expertProvider.registerExpert(
+                       commonsMediaType,
+                       vv.experts.CommonsMediaType
+               );
+       }
+
+       var urlType = dataTypes.getDataType( 'url' );
+       if( urlType ) {
+               vv.prototype.options.expertProvider.registerExpert(
+                       urlType,
+                       vv.experts.UrlType
+               );
+       }
+
        /**
         * TODO: dataTypes should not be a singleton, instead we should replace 
it with a instantiable
         *  factory, so we can use our own instance just for WB data types here.
         */
        return dataTypes;
 
-}( jQuery, mediaWiki, dataTypes ) );
+}( jQuery, mediaWiki, dataTypes, jQuery.valueview ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d5d0b75ea52bfeb8fd4dcb1fc3033e94c1c9b61
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.23-wmf11
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>

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

Reply via email to