2013-10-09 20:09:59 +00:00
|
|
|
/*!
|
|
|
|
* ObjectOriented UserInterface FieldsetLayout class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 OOJS Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Layout made of a fieldset and optional legend.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.Layout
|
|
|
|
* @mixins OO.ui.LabeledElement
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
* @cfg {string} [icon] Symbolic icon name
|
|
|
|
*/
|
|
|
|
OO.ui.FieldsetLayout = function OoUiFieldsetLayout( config ) {
|
|
|
|
// Config initialization
|
|
|
|
config = config || {};
|
|
|
|
|
|
|
|
// Parent constructor
|
|
|
|
OO.ui.Layout.call( this, config );
|
|
|
|
|
|
|
|
// Mixin constructors
|
2013-11-01 19:45:59 +00:00
|
|
|
OO.ui.LabeledElement.call( this, this.$( '<legend>' ), config );
|
2013-10-09 20:09:59 +00:00
|
|
|
|
|
|
|
// Initialization
|
|
|
|
if ( config.icon ) {
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$element.addClass( 'oo-ui-fieldsetLayout-decorated' );
|
2013-10-09 20:09:59 +00:00
|
|
|
this.$label.addClass( 'oo-ui-icon-' + config.icon );
|
|
|
|
}
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$element.addClass( 'oo-ui-fieldsetLayout' );
|
2013-10-09 20:09:59 +00:00
|
|
|
if ( config.icon || config.label ) {
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$element
|
2013-10-09 20:09:59 +00:00
|
|
|
.addClass( 'oo-ui-fieldsetLayout-labeled' )
|
|
|
|
.append( this.$label );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( OO.ui.FieldsetLayout, OO.ui.Layout );
|
|
|
|
|
|
|
|
OO.mixinClass( OO.ui.FieldsetLayout, OO.ui.LabeledElement );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
OO.ui.FieldsetLayout.static.tagName = 'fieldset';
|