/*!
- * OOjs UI v0.1.0-pre (571f26d0ab)
+ * OOjs UI v0.1.0-pre (b38d485723)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-11-03T21:02:06Z
+ * Date: 2014-11-04T22:41:45Z
*/
( function ( OO ) {
'ooui-dialog-process-error': 'Something went wrong',
// Label for process dialog dismiss error button, visible when describing errors
'ooui-dialog-process-dismiss': 'Dismiss',
- // Label for process dialog retry action button, visible when describing recoverable errors
- 'ooui-dialog-process-retry': 'Try again'
+ // Label for process dialog retry action button, visible when describing only recoverable errors
+ 'ooui-dialog-process-retry': 'Try again',
+ // Label for process dialog retry action button, visible when describing only warnings
+ 'ooui-dialog-process-continue': 'Continue'
};
/**
* @param {Object} [config] Configuration options
*/
OO.ui.PendingElement = function OoUiPendingElement( config ) {
- // Config initialisation
+ // Configuration initialization
config = config || {};
// Properties
* @param {Object} [config] Configuration options
*/
OO.ui.Layout = function OoUiLayout( config ) {
- // Initialize config
+ // Configuration initialization
config = config || {};
// Parent constructor
* @param {string|jQuery} message Description of error
* @param {Object} [config] Configuration options
* @cfg {boolean} [recoverable=true] Error is recoverable
+ * @cfg {boolean} [warning=false] Whether this error is a warning or not.
*/
OO.ui.Error = function OoUiElement( message, config ) {
// Configuration initialization
// Properties
this.message = message instanceof jQuery ? message : String( message );
this.recoverable = config.recoverable === undefined || !!config.recoverable;
+ this.warning = !!config.warning;
};
/* Setup */
return this.recoverable;
};
+/**
+ * Check if the error is a warning
+ *
+ * @return {boolean} Error is warning
+ */
+OO.ui.Error.prototype.isWarning = function () {
+ return this.warning;
+};
+
/**
* Get error message as DOM nodes.
*
* @param {Object} [config] Configuration options
*/
OO.ui.Theme = function OoUiTheme( config ) {
- // Initialize config
+ // Configuration initialization
config = config || {};
};
* @cfg {jQuery} [$group] Container node, assigned to #$group, omit to use a generated `<div>`
*/
OO.ui.GroupElement = function OoUiGroupElement( config ) {
- // Configuration
+ // Configuration intialization
config = config || {};
// Properties
* @cfg {string} [iconTitle] Icon title text or a function that returns text
*/
OO.ui.IconElement = function OoUiIconElement( config ) {
- // Config intialization
+ // Configuration intialization
config = config || {};
// Properties
* @cfg {string} [indicatorTitle] Indicator title text or a function that returns text
*/
OO.ui.IndicatorElement = function OoUiIndicatorElement( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Properties
* @cfg {boolean} [autoFitLabel=true] Whether to fit the label or not.
*/
OO.ui.LabelElement = function OoUiLabelElement( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Properties
* @cfg {jQuery} [$flagged] Flagged node, assigned to #$flagged, omit to use #$element
*/
OO.ui.FlaggedElement = function OoUiFlaggedElement( config ) {
- // Config initialization
+ // Configuration initialization
config = config || {};
// Properties
* static property 'title' is used.
*/
OO.ui.TitledElement = function OoUiTitledElement( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Properties
* @cfg {string|Function} [title] Title text or a function that returns text
*/
OO.ui.Tool = function OoUiTool( toolGroup, config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
$: this.$,
label: OO.ui.msg( 'ooui-dialog-process-dismiss' )
} );
- this.retryButton = new OO.ui.ButtonWidget( {
- $: this.$,
- label: OO.ui.msg( 'ooui-dialog-process-retry' )
- } );
+ this.retryButton = new OO.ui.ButtonWidget( { $: this.$ } );
this.$errors = this.$( '<div>' );
this.$errorsTitle = this.$( '<div>' );
OO.ui.ProcessDialog.prototype.showErrors = function ( errors ) {
var i, len, $item,
items = [],
- recoverable = true;
+ recoverable = true,
+ warning = false;
for ( i = 0, len = errors.length; i < len; i++ ) {
if ( !errors[i].isRecoverable() ) {
recoverable = false;
}
+ if ( errors[i].isWarning() ) {
+ warning = true;
+ }
$item = this.$( '<div>' )
.addClass( 'oo-ui-processDialog-error' )
.append( errors[i].getMessage() );
} else {
this.currentAction.setDisabled( true );
}
+ if ( warning ) {
+ this.retryButton.setLabel( OO.ui.msg( 'ooui-dialog-process-continue' ) );
+ } else {
+ this.retryButton.setLabel( OO.ui.msg( 'ooui-dialog-process-retry' ) );
+ }
this.retryButton.toggle( recoverable );
this.$errorsTitle.after( this.$errorItems );
this.$errors.show().scrollTop( 0 );
* @cfg {boolean} [editable=false] Show controls for adding, removing and reordering pages
*/
OO.ui.BookletLayout = function OoUiBookletLayout( config ) {
- // Initialize configuration
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {string} [help] Explanatory text shown as a '?' icon.
*/
OO.ui.FieldLayout = function OoUiFieldLayout( fieldWidget, config ) {
- // Config initialization
+ // Configuration initialization
config = $.extend( { align: 'left' }, config );
// Parent constructor
* @cfg {OO.ui.FieldLayout[]} [items] Items to add
*/
OO.ui.FieldsetLayout = function OoUiFieldsetLayout( config ) {
- // Config initialization
+ // Configuration initialization
config = config || {};
// Parent constructor
OO.ui.GridLayout = function OoUiGridLayout( panels, config ) {
var i, len, widths;
- // Config initialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {boolean} [expanded=true] Expand size to fill the entire parent element
*/
OO.ui.PanelLayout = function OoUiPanelLayout( config ) {
- // Config initialization
+ // Configuration initialization
config = $.extend( {
scrollable: false,
padded: false,
* @cfg {OO.ui.Layout[]} [items] Layouts to add
*/
OO.ui.StackLayout = function OoUiStackLayout( config ) {
- // Config initialization
+ // Configuration initialization
config = $.extend( { scrollable: true }, config );
// Parent constructor
* @cfg {boolean} [expanded=false] Whether the collapsible tools are expanded by default
*/
OO.ui.ListToolGroup = function OoUiListToolGroup( toolbar, config ) {
+ // Configuration intialization
+ config = config || {};
+
// Properties (must be set before parent constructor, which calls #populate)
this.allowCollapse = config.allowCollapse;
this.forceExpand = config.forceExpand;
* @param {OO.ui.TextInputWidget} input Input widget
* @param {Object} [config] Configuration options
* @cfg {jQuery} [$overlay] Overlay for dropdown; defaults to relative positioning
+ * @cfg {jQuery} [$container=input.$element] Element to render menu under
*/
OO.ui.LookupInputWidget = function OoUiLookupInputWidget( input, config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Properties
// This way we allow the user to open the menu again after closing it with Esc
// by clicking in the input. Opening (and populating) the menu when initially
// clicking into the input is handled by the focus handler.
- if ( this.lookupInputFocused ) {
- this.openLookupMenu();
+ if ( this.lookupInputFocused && !this.lookupMenu.isVisible() ) {
+ this.populateLookupMenu();
}
};
* @cfg {OO.ui.ButtonWidget[]} [items] Buttons to add
*/
OO.ui.ButtonGroupWidget = function OoUiButtonGroupWidget( config ) {
+ // Configuration initialization
+ config = config || {};
+
// Parent constructor
OO.ui.ButtonGroupWidget.super.call( this, config );
* @cfg {boolean} [framed=false] Render button with a frame
*/
OO.ui.ActionWidget = function OoUiActionWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = $.extend( { framed: false }, config );
// Parent constructor
* @param {Object} [config] Configuration options
*/
OO.ui.IconWidget = function OoUiIconWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @param {Object} [config] Configuration options
*/
OO.ui.IndicatorWidget = function OoUiIndicatorWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @return {jQuery} Input element
*/
OO.ui.ButtonInputWidget.prototype.getInputElement = function ( config ) {
+ // Configuration intialization
+ config = config || {};
+
var html = '<' + ( config.useInputTag ? 'input' : 'button' ) + ' type="' + config.type + '">';
+
return this.$( html );
};
* @return {jQuery} Input element
*/
OO.ui.TextInputWidget.prototype.getInputElement = function ( config ) {
+ // Configuration initialization
+ config = config || {};
+
var type = config.type || 'text';
+
return config.multiline ? this.$( '<textarea>' ) : this.$( '<input type="' + type + '" />' );
};
* @param {Object} [config] Configuration options
*/
OO.ui.LabelWidget = function OoUiLabelWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {string} [rel] Value for `rel` attribute in DOM, allowing per-option styling
*/
OO.ui.OptionWidget = function OoUiOptionWidget( data, config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {boolean} [movable] Allow modification from outline controls
*/
OO.ui.OutlineItemWidget = function OoUiOutlineItemWidget( data, config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {boolean} [padded] Add padding to the body
*/
OO.ui.PopupWidget = function OoUiPopupWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {number} [progress=0] Initial progress
*/
OO.ui.ProgressBarWidget = function OoUiProgressBarWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {OO.ui.OptionWidget[]} [items] Options to add
*/
OO.ui.SelectWidget = function OoUiSelectWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {boolean} [autoHide=true] Hide the menu when the mouse is pressed outside the menu
*/
OO.ui.MenuWidget = function OoUiMenuWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor
* @cfg {jQuery} [$container=input.$element] Element to render menu under
*/
OO.ui.TextInputMenuWidget = function OoUiTextInputMenuWidget( input, config ) {
+ // Configuration intialization
+ config = config || {};
+
// Parent constructor
OO.ui.TextInputMenuWidget.super.call( this, config );
* @param {Object} [config] Configuration options
*/
OO.ui.OutlineWidget = function OoUiOutlineWidget( config ) {
- // Config intialization
+ // Configuration initialization
config = config || {};
// Parent constructor