Daniel Werner has uploaded a new change for review.

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


Change subject: (bug 45002) Using the new "ValueView" extension in Wikibase now.
......................................................................

(bug 45002) Using the new "ValueView" extension in Wikibase now.

Some values might not yet be editable (depending on which change-set of 
ValueView is checked out)
but this change-set will make Wikibase compatible to the new jQuery.valueview.

Change-Id: I0dc23d3dd30ad7a17dfa8177626323ce9c5e6ad6
---
M lib/RELEASE-NOTES
M lib/WikibaseLib.php
M lib/resources/Resources.php
M 
lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js
M lib/resources/wikibase.css
M repo/Wikibase.i18n.php
6 files changed, 13 insertions(+), 41 deletions(-)


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

diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 80d6592..1b688e1 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -24,6 +24,7 @@
 ; Requirements
 
 * If experimental features are enabled, then this will depends on "Ask" 
extension now. See Extension page on mediawiki.org: 
https://www.mediawiki.org/wiki/Extension:Ask
+* Requires "ValueView" extension now which can be found in the "DataValues" 
GIT repo.
 
 
 === Version 0.3 ===
diff --git a/lib/WikibaseLib.php b/lib/WikibaseLib.php
index a2f522c..5237e2c 100644
--- a/lib/WikibaseLib.php
+++ b/lib/WikibaseLib.php
@@ -62,6 +62,7 @@
        'DataValues_VERSION' => 'DataValues',
        'ValueParsers_VERSION' => 'ValueParsers',
        'DataTypes_VERSION' => 'DataTypes',
+       'ValueView_VERSION' => 'ValueView',
 );
 
 foreach ( $dependencies as $constant => $name ) {
diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index 49ed5f1..d49df6a 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -522,8 +522,7 @@
                                'jquery.nativeEventHandler',
                                'jquery.wikibase.entityselector',
                                'wikibase.datamodel',
-                               'dataTypes.jquery.valueview.views',
-                               'wikibase.jquery.valueview.views',
+                               'mw.ext.valueView',
                                'wikibase.store', // required for getting 
datatype from entityselector selected property
                                'mediawiki.legacy.shared',
                                'jquery.ui.TemplatedWidget'
@@ -532,8 +531,6 @@
                                'wikibase-snakview-property-input-placeholder',
                                'wikibase-snakview-unsupportedsnaktype',
                                'wikibase-snakview-choosesnaktype',
-                               
'wikibase-snakview-variation-unsupporteddatatype',
-                               
'wikibase-snakview-variation-unsupporteddatavalue',
                                
'wikibase-snakview-variation-datavaluetypemismatch',
                                
'wikibase-snakview-variation-datavaluetypemismatch-details',
                                
'wikibase-snakview-variation-nonewvaluefordeletedproperty',
@@ -643,7 +640,7 @@
                                'jquery.valueview.views/views.css',
                        ),
                        'dependencies' => array(
-                               'dataTypes.jquery.valueview',
+                               'jquery.valueview',
                                'wikibase.parsers',
                                'jquery.eachchange',
                                'wikibase.utilities',
diff --git 
a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js
 
b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js
index 4028231..ab4271f 100644
--- 
a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js
+++ 
b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js
@@ -137,9 +137,9 @@
                                        // can't check whether current 
valueview is most suitable for empty value if no
                                        // indication for what kind of value 
(specified by the data type) is available
                                        && ( dataType || newValue !== null )
-                                       && this._valueView.isMostSuitableFor( 
dataType || newValue )
                                ) {
                                        // display current Snak's data value in 
existing valueview:
+                                       this._valueView.option( 'on', dataType 
);
                                        this._valueView.value( newValue );
                                } else {
                                        // remove old view, create a new one or 
display message if unsupported data type
@@ -206,37 +206,13 @@
                                return false; // no valueview created!
                        }
 
-                       // check if there is a suitable valueview:
-                       if( !$.valueview.canChooseView( valueviewCriteria ) ) {
-                               // display message instead if there is no input 
method for data values of that type:
-                               var unsupportedMsg;
-
-                               if( dataType ) {
-                                       // no view for that values of that data 
type or the data type's data value type
-                                       unsupportedMsg = mw.msg(
-                                               
'wikibase-snakview-variation-unsupporteddatatype', dataType.getLabel() );
-                                       // NOTE: this also implies that the 
data value type is unsupported but the
-                                       //  message is more specific than that.
-                               } else {
-                                       // no view for the value's value type
-                                       unsupportedMsg = mw.msg(
-                                               
'wikibase-snakview-variation-unsupporteddatavalue', dataValue.getType() );
-                               }
-
-                               $valueViewDom
-                               .text( unsupportedMsg )
-                               .addClass( this.variationBaseClass + 
'-unsupporteddatavalue' );
-
-                               return false; // no valueview created!
-                       }
-
                        // TODO: Use something like an 'editview' and just 
change its data type rather than
                        //  initializing this over and over again and doing the 
checks.
-                       $valueViewDom.valueview( { on: valueviewCriteria } );
+                       $valueViewDom.valueview( {
+                               on: valueviewCriteria,
+                               value: dataValue
+                       } );
                        this._valueView = $valueViewDom.data( 'valueview' );
-
-                       // NOTE: if valueview values can be set initially some 
day, do it for performance
-                       this._valueView.value( dataValue );
 
                        $valueViewDom
                        .on( 'valueviewparse.snakview-variations-value', 
function( event ) {
diff --git a/lib/resources/wikibase.css b/lib/resources/wikibase.css
index d66d01f..d2103f0 100644
--- a/lib/resources/wikibase.css
+++ b/lib/resources/wikibase.css
@@ -596,6 +596,10 @@
        margin-top: 0.4em;
 }
 
+.wb-snakview-variation-valuesnak textarea {
+       width: 100%;
+}
+
 /***** /EDIT/NEW CLAIM *****/
 
 /***** QUALIFIERS *****/
diff --git a/repo/Wikibase.i18n.php b/repo/Wikibase.i18n.php
index 8e12552..62ac214 100644
--- a/repo/Wikibase.i18n.php
+++ b/repo/Wikibase.i18n.php
@@ -76,8 +76,6 @@
        'wikibase-snakview-property-input-placeholder' => 'property',
        'wikibase-snakview-unsupportedsnaktype' => 'Snak of type "$1". Handling 
for this kind of Snak is not yet supported.',
        'wikibase-snakview-choosesnaktype' => 'Choose a value type.',
-       'wikibase-snakview-variation-unsupporteddatatype' => 'Handling of 
values for "$1" data type is not yet supported.',
-       'wikibase-snakview-variation-unsupporteddatavalue' => 'Handling of "$1" 
data values is not yet supported.',
        'wikibase-snakview-variation-datavaluetypemismatch' => 'The value does 
not comply with the property\'s definition.',
        'wikibase-snakview-variation-datavaluetypemismatch-details' => 'The 
value\'s data value type "$1" does not match the property\'s data type\'s data 
value type "$2".',
        'wikibase-snakview-variation-nonewvaluefordeletedproperty' => 'It is 
not possible to define a new value for a deleted property.',
@@ -537,11 +535,6 @@
 Since a default Snak type should always be selected when adding a Snak, the 
message is visible on rare occasions only.
 
 Since "Snak" or "Snak type" does not express any meaning for the user, these 
phrases should be avoided in the message.',
-       'wikibase-snakview-variation-unsupporteddatatype' => 'Error shown if a 
data value for a certain data type (see [[d:Wikidata:Glossary]]) should be 
displayed or a form for creating one should be offered while this is not yet 
possible from a technical point of view (e.g. because a widget handling data 
values for that data type has not yet been implemented).
-
-Parameters:
-* $1 - the name of the data type which lacks support',
-       'wikibase-snakview-variation-unsupporteddatavalue' => 'Error shown if a 
data value of a certain data value type (see [[d:Wikidata:Glossary]]) should be 
displayed or a form for creating one should be offered while this is not yet 
possible from a technical point of view (e.g. because a widget handling data 
values of that type has not yet been implemented). $1 is the name of the data 
value type which lacks support.',
        'wikibase-snakview-variation-datavaluetypemismatch' => "Warning 
displayed if the data value type used by a Snak's (see [[d:Wikidata:Glossary]]) 
property's data type is different from the data value type of the same Snak's 
actual value. This should only appear after internal changes or after a 
property's data type has changed and no scripts for updating the data were 
executed (there might not even be any scripts for handling all possible causes 
of this).",
        'wikibase-snakview-variation-datavaluetypemismatch-details' => "Details 
of the warning displayed if the data value type used by a Snak's (see 
[[d:Wikidata:Glossary]]) property's data type is different from the data value 
type of the same Snak's actual value.
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0dc23d3dd30ad7a17dfa8177626323ce9c5e6ad6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <daniel.wer...@wikimedia.de>

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

Reply via email to