Jonas Kress (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/251486
Change subject: Block statement saving on invalid and empty reference ...................................................................... Block statement saving on invalid and empty reference this also fixes Enable save button on reference change. Bug: T117700 Bug: T117701 Change-Id: I064bb8650368242c61fe53d3be2a8b0fc89fc674 --- M view/resources/jquery/wikibase/jquery.wikibase.statementview.js 1 file changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/86/251486/1 diff --git a/view/resources/jquery/wikibase/jquery.wikibase.statementview.js b/view/resources/jquery/wikibase/jquery.wikibase.statementview.js index 82b1e39..7ab5757 100644 --- a/view/resources/jquery/wikibase/jquery.wikibase.statementview.js +++ b/view/resources/jquery/wikibase/jquery.wikibase.statementview.js @@ -319,6 +319,11 @@ self._trigger( 'afterremove' ); } } ) + .on( lia.prefixedEvent( 'change.'+ this.widgetName ), + function( event ) { + event.stopPropagation(); + self._trigger( 'change' ); + }) .on( 'listviewenternewitem', function( event, $newLi ) { if ( event.target !== $listview[0] ) { return; @@ -787,6 +792,10 @@ return false; } + if ( this._hasInvalidReferences() ) { + return false; + } + if ( this._qualifiers ) { snaklistviews = this._qualifiers.value(); @@ -803,6 +812,22 @@ }, /** + * @return {boolean} + */ + _hasInvalidReferences: function() { + var isInvalid = false; + $.each( this._referencesListview.value(), function ( key, referenceView ) { + if ( !referenceView.isValid() ) { + isInvalid = true; + return; + } + } ); + + return isInvalid; + }, + + + /** * @inheritdoc * @protected * -- To view, visit https://gerrit.wikimedia.org/r/251486 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I064bb8650368242c61fe53d3be2a8b0fc89fc674 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits