Tobias Gritschacher has submitted this change and it was merged.

Change subject: (bug 46123, hot fix) Activated language terms table would not 
allow for editing statements
......................................................................


(bug 46123, hot fix) Activated language terms table would not allow for editing 
statements

When the language terms table is active, editing/adding of statements is not 
working since
8f0ec909. This is because that change-set introduced having the second 
parameter of the
"startItemPageEditMode" event set to a DOM node instead of undefined in case of 
a
jQuery.wikibase widget would be responsible for triggering the event. In case of
wikibase.ui.PropertyEditTool related ui components triggering the event, a
wikibase.ui.PropertyEditTool.EditableValue would be given as second parameter. 
Code
expecting a EditableValue failed when after 8f0ec909 a DOM node would be given 
on statements
related edit interaction.

Change-Id: Ifd908f481f0f671797f2d0ff503fd2125dc9b91d
---
M lib/resources/wikibase.js
M repo/resources/wikibase.ui.entityViewInit.js
2 files changed, 15 insertions(+), 3 deletions(-)

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



diff --git a/lib/resources/wikibase.js b/lib/resources/wikibase.js
index e0ed59f..78dbb0b 100644
--- a/lib/resources/wikibase.js
+++ b/lib/resources/wikibase.js
@@ -13,10 +13,16 @@
  * Global 'Wikibase' extension singleton.
  * @since 0.1
  *
+ * TODO: startItemPageEditMode and stopItemPageEditMode should be removed or 
marked deprecated as
+ *       soon as we can get rid of old wb.ui.PropertyEditTool ui. There should 
be no global edit
+ *       mode event anymore since with the new jQuery.wikibase widgets all 
editing related events
+ *       bubble through the DOM anyhow, so everyone can listen to those on any 
level of a pages DOM.
  *
  * @event startItemPageEditMode: Triggered when any edit mode on the item page 
is started
  *        (1) {jQuery.Event}
- *        (2) {wb.ui.PropertyEditTool.EditableValue} origin Object which 
triggered the event
+ *        (2) {wb.ui.PropertyEditTool.EditableValue|jQuery} origin Object 
which triggered the event.
+ *            If the origin of the event is one of the new (jQuery.wikibase) 
widgets, then this will
+ *            be the widget's DOM node.
  *
  * @event newItemCreated: Triggered after an item has been created and the 
necessary API request has
  *        returned.
@@ -26,7 +32,9 @@
  *
  * @event stopItemPageEditMode: Triggered when any edit mode on the item page 
is stopped.
  *        (1) {jQuery.Event}
- *        (2) {wb.ui.PropertyEditTool.EditableValue} origin Object which 
triggered the event
+ *        (2) {wb.ui.PropertyEditTool.EditableValue|jQuery} origin Object 
which triggered the event.
+ *            If the origin of the event is one of the new (jQuery.wikibase) 
widgets, then this will
+ *            be the widget's DOM node.
  *        (3) {Boolean} wasPending Whether value was a previously not 
existent/new value that has
  *            just been added
  *
diff --git a/repo/resources/wikibase.ui.entityViewInit.js 
b/repo/resources/wikibase.ui.entityViewInit.js
index 53e5880..73a9f21 100644
--- a/repo/resources/wikibase.ui.entityViewInit.js
+++ b/repo/resources/wikibase.ui.entityViewInit.js
@@ -167,8 +167,12 @@
                }
 
                $( wb ).on( 'startItemPageEditMode', function( event, origin, 
options ) {
+                       // disable language terms table's editable value or 
mark it as the active one if it is
+                       // the one being edited by the user and therefore the 
origin of the event
                        $.each( termsValueTools, function( i, termValueTool ) {
-                               if ( !origin || origin.getSubject() !== 
termValueTool.getSubject() ) {
+                               if ( !( origin instanceof 
wb.ui.PropertyEditTool.EditableValue )
+                                       || origin.getSubject() !== 
termValueTool.getSubject()
+                               ) {
                                        termValueTool.disable();
                                } else if ( origin && origin.getSubject() === 
termValueTool.getSubject() ) {
                                        $( 'table.wb-terms' ).addClass( 
'wb-edit' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd908f481f0f671797f2d0ff503fd2125dc9b91d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <[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