Tobias Gritschacher has submitted this change and it was merged.

Change subject: (bug 45505) Removing isSaveDisabled() from claimview
......................................................................


(bug 45505) Removing isSaveDisabled() from claimview

Since there should be no specific toolbar interactions in claimview anymore,
saveDisabled() does not belong there. Its purpose got already replaced by
isValid(). This change fixes "enter" key handling when saving a claim.

Change-Id: I2069762ab47dd0d8fcebd922e1e3cce32684fd0d
---
M lib/resources/jquery.wikibase/jquery.wikibase.claimlistview.js
M lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
2 files changed, 3 insertions(+), 19 deletions(-)

Approvals:
  Tobias Gritschacher: Verified; Looks good to me, approved



diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.claimlistview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.claimlistview.js
index 2d45431..3ef8e39 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.claimlistview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.claimlistview.js
@@ -351,7 +351,7 @@
                .on( this._lmwEvent( 'stopediting' ), function( event, 
dropValue ) {
                        var newSnak = self._lmwInstance( $newClaim 
).$mainSnak.data( 'snakview' ).snak();
 
-                       if ( self._lmwInstance( $newClaim ).isSaveDisabled() && 
!dropValue ) {
+                       if ( !self._lmwInstance( $newClaim ).isValid() && 
!dropValue ) {
                                event.preventDefault();
                                return;
                        }
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
index 635e5fb..b683eff 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
@@ -115,12 +115,6 @@
        _isInEditMode: false,
 
        /**
-        * Whether saving is (currently) disabled.
-        * @type {boolean}
-        */
-       _saveDisabled: false,
-
-       /**
         * Whether the widget is currently valid according to its contents.
         * @type {boolean}
         */
@@ -145,7 +139,7 @@
                } )
                .on( 'snakviewstopediting', function( event, dropValue ) {
                        // React on key stroke events (e.g. pressing enter or 
ESC key)
-                       if ( self.isSaveDisabled() && !dropValue ) {
+                       if ( !self.isValid() && !dropValue ) {
                                event.preventDefault();
                                return;
                        }
@@ -232,7 +226,7 @@
        stopEditing: $.NativeEventHandler( 'stopEditing', {
                // don't stop edit mode or trigger event if not in edit mode 
currently:
                initially: function( e, dropValue ) {
-                       if( !this.isInEditMode() || this._saveDisabled && 
!dropValue ) {
+                       if( !this.isInEditMode() || !this.isValid() && 
!dropValue ) {
                                e.cancel();
                        }
 
@@ -423,16 +417,6 @@
         */
        enable: function() {
                this.$mainSnak.data( 'snakview' ).enable();
-       },
-
-       /**
-        * Returns whether saving is currently disabled.
-        * @since 0.4
-        *
-        * @return {boolean}
-        */
-       isSaveDisabled: function() {
-               return this._saveDisabled;
        },
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2069762ab47dd0d8fcebd922e1e3cce32684fd0d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to