Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/177186
Change subject: sitelinkview: Applied inputautoexpand to page name input
......................................................................
sitelinkview: Applied inputautoexpand to page name input
Change-Id: I5a160784e8cf86cae6f45b1370c0265e8aa59bba
---
M lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
1 file changed, 30 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/86/177186/1
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
index 583a267..9f0679a 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
@@ -154,6 +154,8 @@
}
} )
.on( 'badgeselectorchange', function( event ) {
+ // Adding/removing badges decreases/increases available
space:
+ self._updatePageNameInputAutoExpand();
self._trigger( 'change' );
} );
@@ -221,9 +223,14 @@
self.setError();
self._trigger( 'change' );
}
- );
+ )
+ .on( 'focus.' + this.widgetName, function() {
+ self._updatePageNameInputAutoExpand();
+ } );
this.$link.find( '.wikibase-sitelinkview-page'
).empty().append( $pageNameInput );
+
+ $pageNameInput.inputautoexpand();
if( this.options.value ) {
// Site of an existing site link is not supposed to be
changeable.
@@ -264,6 +271,8 @@
if( inputautoexpand ) {
inputautoexpand.expand();
}
+
+ self._updatePageNameInputAutoExpand();
}
);
@@ -286,6 +295,26 @@
},
/**
+ * Updates the maximum width the page name input element may grow to.
+ * @private
+ */
+ _updatePageNameInputAutoExpand: function() {
+ var $pageNameInput = this.$link.find( 'input' );
+
+ if( !$pageNameInput.length ) {
+ return;
+ }
+
+ $pageNameInput.inputautoexpand( {
+ maxWidth: Math.floor( this.element.width()
+ - this.$siteIdContainer.outerWidth( true )
+ - ( this.$link.outerWidth( true ) -
$pageNameInput.width() ) )
+ } );
+
+ $pageNameInput.data( 'inputautoexpand' ).expand( true );
+ },
+
+ /**
* @return {boolean}
*/
isEmpty: function() {
--
To view, visit https://gerrit.wikimedia.org/r/177186
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a160784e8cf86cae6f45b1370c0265e8aa59bba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits