Krenair

OOjs UI LabeledElement configurable autoEllipsis patch

Mar 13th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.43 KB | None | 0 0
  1. diff --git a/resources/oojs-ui/oojs-ui.js b/resources/oojs-ui/oojs-ui.js
  2. index 1f13047..1c42bbc 100644
  3. --- a/resources/oojs-ui/oojs-ui.js
  4. +++ b/resources/oojs-ui/oojs-ui.js
  5. @@ -2459,6 +2459,7 @@ OO.ui.IndicatedElement.prototype.getIndicatorTitle = function () {
  6.   * @param {jQuery} $label Label node, assigned to #$label
  7.   * @param {Object} [config] Configuration options
  8.   * @cfg {jQuery|string|Function} [label] Label nodes, text or a function that returns nodes or text
  9. + * @cfg {bool} [autoEllipsis] Whether to use autoEllipsis when fitting the label or not. Defaults to true.
  10.   */
  11.  OO.ui.LabeledElement = function OoUiLabeledElement( $label, config ) {
  12.         // Config intialization
  13. @@ -2471,6 +2472,7 @@ OO.ui.LabeledElement = function OoUiLabeledElement( $label, config ) {
  14.         // Initialization
  15.         this.$label.addClass( 'oo-ui-labeledElement-label' );
  16.         this.setLabel( config.label || this.constructor.static.label );
  17. +       this.autoEllipsis = config.autoEllipsis;
  18.  };
  19.  
  20.  /* Static Properties */
  21. @@ -2541,7 +2543,7 @@ OO.ui.LabeledElement.prototype.getLabel = function () {
  22.   * @chainable
  23.   */
  24.  OO.ui.LabeledElement.prototype.fitLabel = function () {
  25. -       if ( this.$label.autoEllipsis ) {
  26. +       if ( this.$label.autoEllipsis && ( this.autoEllipsis === undefined || this.autoEllipsis ) ) {
  27.                 this.$label.autoEllipsis( { 'hasSpan': false, 'tooltip': true } );
  28.         }
  29.         return this;
Advertisement
Add Comment
Please, Sign In to add comment