jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/330228 )

Change subject: Added support for geo shapes
......................................................................


Added support for geo shapes

Bug: T57549
Change-Id: Ia2b4b67167014fac048c2abd4e713d059577a0a4
---
M RELEASE-NOTES.md
M ValueView.php
M lib/jquery.ui/jquery.ui.commonssuggester.js
A src/experts/GeoShape.js
M src/experts/resources.php
5 files changed, 71 insertions(+), 3 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, approved



diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 2e273c6..31d617f 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,5 +1,8 @@
 # ValueView release notes
 
+## 0.18.1 (2016-01-03)
+* Added support for `geo-shape` data type.
+
 ## 0.18.0 (2016-10-14)
 * `jQuery.ui.commonssuggester` now allows pasting full and partial Wikimedia 
Commons URLs.
 * Added support for `null` precision to `GlobeCoordinateInput`.
diff --git a/ValueView.php b/ValueView.php
index cc535df..5e3f98f 100644
--- a/ValueView.php
+++ b/ValueView.php
@@ -5,7 +5,7 @@
        return 1;
 }
 
-define( 'VALUEVIEW_VERSION', '0.18.0' );
+define( 'VALUEVIEW_VERSION', '0.18.1' );
 
 // Include the composer autoloader if it is present.
 if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
diff --git a/lib/jquery.ui/jquery.ui.commonssuggester.js 
b/lib/jquery.ui/jquery.ui.commonssuggester.js
index 2720637..ab810e0 100644
--- a/lib/jquery.ui/jquery.ui.commonssuggester.js
+++ b/lib/jquery.ui/jquery.ui.commonssuggester.js
@@ -1,6 +1,12 @@
 ( function( $, util ) {
        'use strict';
 
+       // TODO: Avoid using namespaces here instead use filters within 
opensearch
+       var NAMESPACE = {
+               File: 6,
+               Data: 486
+       };
+
        /**
         * Commons suggester.
         * Enhances an input box with suggestion functionality for Wikimedia 
Commons asset names.
@@ -19,7 +25,8 @@
                 * @see jQuery.ui.suggester.options
                 */
                options: {
-                       ajax: $.ajax
+                       ajax: $.ajax,
+                       namespace: null
                },
 
                /**
@@ -51,7 +58,7 @@
                                        data: {
                                                search: 
self._grepFileTitleFromTerm( term ),
                                                action: 'opensearch',
-                                               namespace: 6
+                                               namespace: 
NAMESPACE[self.options.namespace] || NAMESPACE.File
                                        },
                                        timeout: 8000
                                } )
diff --git a/src/experts/GeoShape.js b/src/experts/GeoShape.js
new file mode 100644
index 0000000..4fbd8d7
--- /dev/null
+++ b/src/experts/GeoShape.js
@@ -0,0 +1,45 @@
+( function( $, vv ) {
+       'use strict';
+
+       var PARENT = vv.experts.StringValue;
+
+       /**
+        * `Valueview` expert for adding specialized handling for `geo-shape` 
data type.
+        * Without this more specialized expert, the `StringValue` expert would 
be used since the
+        * `geo-shape` data type is using the `String` data value type.
+        * This expert is based on the `StringValue` expert but will add a 
drop-down for choosing
+        * Commons data sources. It will also display the value as a link to 
Commons.
+        * @class jQuery.valueview.experts.GeoShape
+        * @extends jQuery.valueview.experts.StringValue
+        * @since 0.1
+        * @licence GNU GPL v2+
+        * @author Daniel Werner < [email protected] >
+        */
+       vv.experts.GeoShape = vv.expert( 'GeoShape', PARENT, {
+               /**
+                * @inheritdoc
+                * @protected
+                */
+               _init: function() {
+                       PARENT.prototype._init.call( this );
+
+                       var notifier = this._viewNotifier,
+                               $input = this.$input;
+
+                       $input.commonssuggester( { namespace: 'Data' } );
+
+                       // Using the inputautoexpand plugin, the position of 
the dropdown needs to be updated
+                       // whenever the input box expands vertically:
+                       $input
+                       .on( 'eachchange', function( event, oldValue ) {
+                               // TODO/OPTIMIZE: Only reposition when 
necessary, i.e. when expanding vertically
+                               $input.data( 'commonssuggester' 
).repositionMenu();
+                       } )
+                       .on( 'commonssuggesterchange', function( event, 
response ) {
+                               notifier.notify( 'change' );
+                               $input.data( 'inputautoexpand' ).expand();
+                       } );
+               }
+       } );
+
+}( jQuery, jQuery.valueview ) );
diff --git a/src/experts/resources.php b/src/experts/resources.php
index 792920d..7c05911 100644
--- a/src/experts/resources.php
+++ b/src/experts/resources.php
@@ -31,6 +31,19 @@
                        ),
                ),
 
+               'jquery.valueview.experts.GeoShape' => $moduleTemplate + array(
+                               'scripts' => array(
+                                               'GeoShape.js',
+                               ),
+                               'dependencies' => array(
+                                               
'jquery.event.special.eachchange',
+                                               'jquery.ui.commonssuggester',
+                                               'jquery.valueview.experts',
+                                               
'jquery.valueview.experts.StringValue',
+                                               'jquery.valueview.Expert',
+                               ),
+               ),
+
                'jquery.valueview.experts.EmptyValue' => $moduleTemplate + 
array(
                        'scripts' => array(
                                'EmptyValue.js',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2b4b67167014fac048c2abd4e713d059577a0a4
Gerrit-PatchSet: 6
Gerrit-Project: data-values/value-view
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to