Daniel Werner has uploaded a new change for review.

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


Change subject: (bug 49306) valueview Expert for handling values for URL data 
type
......................................................................

(bug 49306) valueview Expert for handling values for URL data type

Required by I4544cc0cf03bbd5a2038fc1c238f12d1b6ea080b in Wikibase for nicer 
display of values of
URL data type.

Change-Id: I9ab14abc87f0f237aade30cc060b5fd7dda11f84
---
M ValueView/ValueView.resources.php
M 
ValueView/resources/jquery.valueview/valueview.experts/experts.CommonsMediaType.js
A ValueView/resources/jquery.valueview/valueview.experts/experts.UrlType.js
M ValueView/resources/mw.ext.valueView.js
4 files changed, 69 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/77/74277/1

diff --git a/ValueView/ValueView.resources.php 
b/ValueView/ValueView.resources.php
index 3f46031..80b63f3 100644
--- a/ValueView/ValueView.resources.php
+++ b/ValueView/ValueView.resources.php
@@ -288,6 +288,17 @@
                        ),
                ),
 
+               'jquery.valueview.experts.urltype' => $moduleTemplate + array(
+                       'scripts' => array(
+                               
'jquery.valueview/valueview.experts/experts.UrlType.js',
+                       ),
+                       'dependencies' => array(
+                               'jquery.valueview.experts.staticdom',
+                               'jquery.valueview.BifidExpert',
+                               'jquery.valueview.experts.stringvalue'
+                       ),
+               ),
+
                'jquery.valueview.preview' => $moduleTemplate + array(
                        'scripts' => array(
                                'jquery.valueview/valueview.preview.js',
diff --git 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.CommonsMediaType.js
 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.CommonsMediaType.js
index 7c70e3d..c1ee124 100644
--- 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.CommonsMediaType.js
+++ 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.CommonsMediaType.js
@@ -30,7 +30,7 @@
         * @since 0.1
         *
         * @constructor
-        * @extends jQuery.valueview.experts.StringValue
+        * @extends jQuery.valueview.experts.BifidExpert
         */
        vv.experts.CommonsMediaType = vv.expert( 'commonsmediatype', PARENT, {
                /**
diff --git 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.UrlType.js 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.UrlType.js
new file mode 100644
index 0000000..fbcec3c
--- /dev/null
+++ b/ValueView/resources/jquery.valueview/valueview.experts/experts.UrlType.js
@@ -0,0 +1,52 @@
+/**
+ * @file
+ * @ingroup ValueView
+ * @licence GNU GPL v2+
+ * @author Daniel Werner < [email protected] >
+ */
+( function( dv, vp, $, vv ) {
+       'use strict';
+
+       var PARENT = vv.BifidExpert,
+               editableExpert = vv.experts.StringValue;
+
+       /**
+        * Valueview expert for displaying values for URL data type as actual 
URLs. Editing will behave
+        * just like editing strings.
+        *
+        * @since 0.1
+        *
+        * @constructor
+        * @extends jQuery.valueview.experts.BifidExpert
+        */
+       vv.experts.UrlType = vv.expert( 'urltype', PARENT, {
+               /**
+                * @see jQuery.valueview.BifidExpert._editableExpert
+                */
+               _editableExpert: editableExpert,
+
+               /**
+                * @see jQuery.valueview.BifidExpert._editableExpertOptions
+                */
+               _editableExpertOptions: {},
+
+               /**
+                * @see jQuery.valueview.BifidExpert._staticExpert
+                */
+               _staticExpert: vv.experts.StaticDom,
+
+               /**
+                * @see jQuery.valueview.BifidExpert._staticExpertOptions
+                */
+               _staticExpertOptions: {
+                       domBuilder: function( currentRawValue, viewState ) {
+                               return $( '<a/>', {
+                                       text: currentRawValue,
+                                       href: currentRawValue
+                               } );
+                       },
+                       baseExpert: editableExpert
+               }
+       } );
+
+}( dataValues, valueParsers, jQuery, jQuery.valueview ) );
diff --git a/ValueView/resources/mw.ext.valueView.js 
b/ValueView/resources/mw.ext.valueView.js
index bd58abe..67c3e39 100644
--- a/ValueView/resources/mw.ext.valueView.js
+++ b/ValueView/resources/mw.ext.valueView.js
@@ -35,6 +35,11 @@
                vv.experts.CommonsMediaType
        );
 
+       expertProvider.registerExpert(
+               dt.getDataType( 'url' ),
+               vv.experts.UrlType
+       );
+
        /**
         * Object representing the MeidaWiki "ValueView" extension.
         *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ab14abc87f0f237aade30cc060b5fd7dda11f84
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <[email protected]>

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

Reply via email to