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

Change subject: claimview: Re-attaching event listeners when creating qualifiers
......................................................................


claimview: Re-attaching event listeners when creating qualifiers

(bug 48748)
Re-attaching the edit mode event listeners when creating the listview to contain
the qualifier snakviews. This ensures receiving the events triggered by the
qualifier snakviews when adding the first qualifier(s) to a claim.

Change-Id: Ibd2d9884814b565501684247e5b5f3c2d9f2f2c4
---
M lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
1 file changed, 8 insertions(+), 3 deletions(-)

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



diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
index 81c5269..c1826a1 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
@@ -230,6 +230,8 @@
                        } );
 
                this._qualifiers = $qualifiers.data( 'listview' );
+
+               this._attachEditModeEventHandlers();
        },
 
        /**
@@ -493,6 +495,8 @@
        _attachEditModeEventHandlers: function() {
                var self = this;
 
+               this._detachEditModeEventHandlers();
+
                function defaultHandling( event, dropValue ) {
                        event.stopImmediatePropagation();
                        event.preventDefault();
@@ -501,12 +505,13 @@
                        self.stopEditing( dropValue );
                }
 
-               this.$mainSnak.one( 'snakviewstopediting', function( event, 
dropValue ) {
+               this.$mainSnak.one( 'snakviewstopediting.' + this.widgetName, 
function( event, dropValue ) {
                        defaultHandling( event, dropValue );
                } );
 
-               if( this._qualifiers && this._qualifiers.value().length ) {
-                       this._qualifiers.element.one( 
'snaklistviewstopediting', function( event, dropValue ) {
+               if( this._qualifiers ) {
+                       this._qualifiers.element
+                       .one( 'snaklistviewstopediting.' + this.widgetName, 
function( event, dropValue ) {
                                defaultHandling( event, dropValue );
                        } );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd2d9884814b565501684247e5b5f3c2d9f2f2c4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to