Rename deprecated Card to current TabPanel

Renaming CardLayout to TabPanelLayout and all connected code instances.
Follow-up to Icfe1652cc038dc131b6b855ce9b45040b8ee5178

Bug: T164903
Change-Id: I9ce4e31e390522d469e126fb3a4b05787cef7fef
This commit is contained in:
Volker E 2017-05-10 11:46:49 -07:00
parent 2f40972807
commit f695877de7
3 changed files with 37 additions and 37 deletions

View file

@ -42,7 +42,7 @@ ve.ui.MWGalleryDialog.static.modelClasses = [ ve.dm.MWGalleryNode ];
* @inheritdoc
*/
ve.ui.MWGalleryDialog.prototype.initialize = function () {
var imagesCard, optionsCard, menuLayout,
var imagesTabPanel, optionsTabPanel, menuLayout,
innerMenuLayout, innerMenuPanel, innerContentPanel,
modeField, captionField, widthsField, heightsField,
perrowField, showFilenameField, classesField, stylesField;
@ -59,25 +59,25 @@ ve.ui.MWGalleryDialog.prototype.initialize = function () {
// Default settings
this.defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions;
// Images and options cards
// Images and options tab panels
this.indexLayout = new OO.ui.IndexLayout( {
scrollable: false,
expanded: true
} );
imagesCard = new OO.ui.CardLayout( 'images', {
imagesTabPanel = new OO.ui.TabPanelLayout( 'images', {
label: ve.msg( 'visualeditor-mwgallerydialog-card-images' ),
expandable: false,
scrollable: false,
padded: true
} );
optionsCard = new OO.ui.CardLayout( 'options', {
optionsTabPanel = new OO.ui.TabPanelLayout( 'options', {
label: ve.msg( 'visualeditor-mwgallerydialog-card-options' ),
expandable: false,
scrollable: false,
padded: true
} );
// Images card
// Images tab panel
// General layout
menuLayout = new OO.ui.MenuLayout( {
@ -138,7 +138,7 @@ ve.ui.MWGalleryDialog.prototype.initialize = function () {
rowHeight: 150
} );
// Options card
// Options tab panel
// Input widgets
this.modeDropdown = new OO.ui.DropdownWidget( {
@ -253,10 +253,10 @@ ve.ui.MWGalleryDialog.prototype.initialize = function () {
this.searchWidget.$element
)
);
imagesCard.$element.append(
imagesTabPanel.$element.append(
menuLayout.$element
);
optionsCard.$element.append(
optionsTabPanel.$element.append(
modeField.$element,
captionField.$element,
widthsField.$element,
@ -266,9 +266,9 @@ ve.ui.MWGalleryDialog.prototype.initialize = function () {
classesField.$element,
stylesField.$element
);
this.indexLayout.addCards( [
imagesCard,
optionsCard
this.indexLayout.addTabPanels( [
imagesTabPanel,
optionsTabPanel
] );
this.$body.append( this.indexLayout.$element );
};
@ -286,7 +286,7 @@ ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
dialog = this,
attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs;
// Images card
// Images tab panel
// If editing an existing gallery, populate with the images...
if ( this.selectedNode ) {
imageTitles = [];
@ -334,7 +334,7 @@ ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
this.toggleSearchPanel( true );
}
// Options card
// Options tab panel
// Set options
mode = attributes && attributes.mode || this.defaults.mode;
@ -430,7 +430,7 @@ ve.ui.MWGalleryDialog.prototype.getBodyHeight = function () {
};
/**
* Request the images for the images card menu
* Request the images for the images tab panel menu
*
* @param {Object} options Options for the request
*/
@ -657,7 +657,7 @@ ve.ui.MWGalleryDialog.prototype.toggleSearchPanel = function ( visible ) {
* Resize the dialog according to which panel is focused
*/
ve.ui.MWGalleryDialog.prototype.updateDialogSize = function () {
if ( this.searchPanelVisible && this.indexLayout.currentCardName === 'images' ) {
if ( this.searchPanelVisible && this.indexLayout.currentTabPanelName === 'images' ) {
this.setSize( 'larger' );
} else {
this.setSize( 'large' );
@ -694,7 +694,7 @@ ve.ui.MWGalleryDialog.prototype.getCurrentData = function () {
data = {},
items = this.galleryGroup.items;
// Get data from options card
// Get data from options tab panel
data.caption = this.captionInput.getValue() || undefined;
data.widths = this.widthsInput.getValue() || undefined;
data.heights = this.heightsInput.getValue() || undefined;

View file

@ -215,11 +215,11 @@ ve.ui.MWMediaDialog.prototype.initialize = function () {
// Define the media search page
this.searchTabs = new OO.ui.IndexLayout();
this.searchTabs.addCards( [
new OO.ui.CardLayout( 'search', {
this.searchTabs.addTabPanels( [
new OO.ui.TabPanelLayout( 'search', {
label: ve.msg( 'visualeditor-dialog-media-search-tab-search' )
} ),
new OO.ui.CardLayout( 'upload', {
new OO.ui.TabPanelLayout( 'upload', {
label: ve.msg( 'visualeditor-dialog-media-search-tab-upload' ),
content: [ this.mediaUploadBooklet ]
} )
@ -381,7 +381,7 @@ ve.ui.MWMediaDialog.prototype.initialize = function () {
} );
// Initialization
this.searchTabs.getCard( 'search' ).$element.append( this.search.$element );
this.searchTabs.getTabPanel( 'search' ).$element.append( this.search.$element );
this.mediaSearchPanel.$element.append( this.searchTabs.$element );
this.generalSettingsPage.$element.append(
this.filenameFieldset.$element,
@ -407,10 +407,10 @@ ve.ui.MWMediaDialog.prototype.initialize = function () {
/**
* Handle set events from the search tabs
*
* @param {OO.ui.CardLayout} card Current card
* @param {OO.ui.TabPanelLayout} tabPanel Current tabPanel
*/
ve.ui.MWMediaDialog.prototype.onSearchTabsSet = function ( card ) {
var name = card.getName();
ve.ui.MWMediaDialog.prototype.onSearchTabsSet = function ( tabPanel ) {
var name = tabPanel.getName();
this.actions.setMode( name );
@ -1129,7 +1129,7 @@ ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) {
dialog.switchPanels( dialog.selectedNode ? 'edit' : 'search' );
if ( data.file ) {
dialog.searchTabs.setCard( 'upload' );
dialog.searchTabs.setTabPanel( 'upload' );
dialog.mediaUploadBooklet.setFile( data.file );
}
} );
@ -1165,7 +1165,7 @@ ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel, stopSearchRequery
}
// Set the edit panel
this.panels.setItem( this.mediaSearchPanel );
this.searchTabs.setCard( 'search' );
this.searchTabs.setTabPanel( 'search' );
this.searchTabs.toggleMenu( true );
this.actions.setMode( this.imageModel ? 'change' : 'select' );
// Layout pending items
@ -1364,7 +1364,7 @@ ve.ui.MWMediaDialog.prototype.getActionProcess = function ( action ) {
break;
case 'cancelupload':
handler = function () {
this.searchTabs.setCard( 'upload' );
this.searchTabs.setTabPanel( 'upload' );
this.searchTabs.toggleMenu( true );
return this.mediaUploadBooklet.initialize();
};

View file

@ -55,14 +55,14 @@ ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
expanded: false
} );
this.linkTypeIndex.addCards( [
new OO.ui.CardLayout( 'internal', {
this.linkTypeIndex.addTabPanels( [
new OO.ui.TabPanelLayout( 'internal', {
label: ve.msg( 'visualeditor-linkinspector-button-link-internal' ),
expanded: false,
scrollable: false,
padded: true
} ),
new OO.ui.CardLayout( 'external', {
new OO.ui.TabPanelLayout( 'external', {
label: ve.msg( 'visualeditor-linkinspector-button-link-external' ),
expanded: false,
scrollable: false,
@ -92,8 +92,8 @@ ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
// Initialization
// HACK: IndexLayout is absolutely positioned, so place actions inside it
this.linkTypeIndex.$content.append( this.$otherActions );
this.linkTypeIndex.getCard( 'internal' ).$element.append( this.internalAnnotationInput.$element );
this.linkTypeIndex.getCard( 'external' ).$element.append( this.externalAnnotationInput.$element );
this.linkTypeIndex.getTabPanel( 'internal' ).$element.append( this.internalAnnotationInput.$element );
this.linkTypeIndex.getTabPanel( 'external' ).$element.append( this.externalAnnotationInput.$element );
this.form.$element.append( this.linkTypeIndex.$element );
};
@ -103,7 +103,7 @@ ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
* @return {boolean} Input mode is for external links
*/
ve.ui.MWLinkAnnotationInspector.prototype.isExternal = function () {
return this.linkTypeIndex.getCurrentCardName() === 'external';
return this.linkTypeIndex.getCurrentTabPanelName() === 'external';
};
/**
@ -172,7 +172,7 @@ ve.ui.MWLinkAnnotationInspector.prototype.updateActions = function () {
* @param {string} value Current value of input widget
*/
ve.ui.MWLinkAnnotationInspector.prototype.onInternalLinkInputChange = function ( value ) {
// If this looks like an external link, switch to the correct card.
// If this looks like an external link, switch to the correct tabPanel.
// Note: We don't care here if it's a *valid* link, so we just
// check whether it looks like a URI -- i.e. whether it starts with
// something that appears to be a schema per RFC1630. Later the external
@ -189,8 +189,8 @@ ve.ui.MWLinkAnnotationInspector.prototype.onInternalLinkInputChange = function (
!this.allowProtocolInInternal &&
/^(?:[a-z][a-z0-9\$\-_@\.&!\*"'\(\),]*:)?\/\//i.test( value.trim() )
) {
this.linkTypeIndex.setCard( 'external' );
// Changing card focuses and selects the input, so collapse the cursor back to the end.
this.linkTypeIndex.setTabPanel( 'external' );
// Changing tabPanel focuses and selects the input, so collapse the cursor back to the end.
this.externalAnnotationInput.getTextInputWidget().moveCursorToEnd();
}
};
@ -208,7 +208,7 @@ ve.ui.MWLinkAnnotationInspector.prototype.createAnnotationInput = function () {
ve.ui.MWLinkAnnotationInspector.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWLinkAnnotationInspector.super.prototype.getSetupProcess.call( this, data )
.next( function () {
this.linkTypeIndex.setCard(
this.linkTypeIndex.setTabPanel(
this.initialAnnotation instanceof ve.dm.MWExternalLinkAnnotation ? 'external' : 'internal'
);
this.annotationInput.setAnnotation( this.initialAnnotation );
@ -276,7 +276,7 @@ ve.ui.MWLinkAnnotationInspector.prototype.getTeardownProcess = function ( data )
/**
* Handle set events from the linkTypeIndex layout
*
* @param {OO.ui.CardLayout} card Current card
* @param {OO.ui.TabPanelLayout} tabPanel Current tabPanel
*/
ve.ui.MWLinkAnnotationInspector.prototype.onLinkTypeIndexSet = function () {
var text = this.annotationInput.getTextInputWidget().getValue(),