mediawiki-extensions-Visual.../modules/ve/ui/layouts/panels/ve.ui.TitledPanelLayout.js
Trevor Parscal 168fcec387 Added layouts and fixed up dialog styling issues
ve.ui.Dialog.css
* Fix issue where the use of margin auto on the outer dialog wrapper
  would expose parts of the underlying content - this is resolved by
  making the outer wrapper cover the whole screen and making the
  window frame use margin auto

ve.ui.Icons*.css
* Added missing settings icon rule

ve.ui.Layout.css
* Added styles for editor panel

ve.ui.Window.css
* Removed default height, setting it specifically in inspector now

ve.ui.EditorPanelLayout.js
* New layout, adds a title and icon above the content

ve.ui.TitledEditorLayout.js
* Similar to labeled widget, but for panels

ve.ui.MetaDialog.js
* Using settings icon now
* Switched to using a specific layout - still hard-coded for
  categories

ve.ui.Frame.js
* Modified style loader to guarantee order of style rules, no matter
  what order they load in

*.php
* Moved layouts to be included after widgets so they can use widgets
* Added links to new layouts

Change-Id: I7ff5f5f095460fd4f6cf841f4182bfb92bf034da
2013-03-26 20:52:35 +00:00

50 lines
1.2 KiB
JavaScript

/*!
* VisualEditor UserInterface TitledPanelLayout class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.TitledPanelLayout object.
*
* @class
* @abstract
*
* @constructor
* @param {jQuery} $title Label element
* @param {Object} [config] Config options
* @cfg {jQuery|string} [title=''] Title text
*/
ve.ui.TitledPanelLayout = function VeUiTitledPanelLayout( $title, config ) {
// Config intialization
config = config || {};
// Properties
this.$title = $title;
// Initialization
this.$title.addClass( 've-ui-titledPanelLayout-title' );
this.setTitle( config.title );
};
/* Methods */
/**
* Set the title.
*
* @method
* @param {jQuery|string} [value] jQuery HTML node selection or string text value to use for label
* @chainable
*/
ve.ui.TitledPanelLayout.prototype.setTitle = function ( value ) {
if ( typeof value === 'string' && value.length && /[^\s]*/.test( value ) ) {
this.$title.text( value );
} else if ( value instanceof jQuery ) {
this.$title.empty().append( value );
} else {
this.$title.html( ' ' );
}
return this;
};