Use add template when adding a new transclusion part

We have two cases now that we want to cover here:
- Either we're inserting a new template and start a "fresh"
  transclusion, then we want to use "search" in the headlines
- Or we're adding a new template to an exsisting
  transclusion, then we want to use "add" in the headlines

Bug: T277028
Change-Id: I9fa294cf732598d58f848c75b353d2e1742eb4e8
This commit is contained in:
WMDE-Fisch 2021-05-11 12:49:06 +02:00
parent 03c277e96a
commit 42b557ff80
2 changed files with 18 additions and 13 deletions

View file

@ -344,12 +344,7 @@ ve.ui.MWTransclusionDialog.prototype.initialize = function () {
this.addTemplateButton = new OO.ui.ButtonWidget( {
framed: false,
icon: 'puzzle',
title: ve.msg(
// Temporary switch for verbose template search.
mw.config.get( 'wgVisualEditorConfig' ).templateSearchImprovements ?
'visualeditor-dialog-transclusion-template-search' :
'visualeditor-dialog-transclusion-add-template'
)
title: ve.msg( 'visualeditor-dialog-transclusion-add-template' )
} );
this.addContentButton = new OO.ui.ButtonWidget( {
framed: false,

View file

@ -82,8 +82,15 @@ ve.ui.MWTemplatePlaceholderPage = function VeUiMWTemplatePlaceholderPage( placeh
};
// Temporary switch for verbose template search.
if ( mw.config.get( 'wgVisualEditorConfig' ).templateSearchImprovements ) {
var dialogTitle = this.placeholder.getTransclusion().parts.length === 1 ?
'visualeditor-dialog-transclusion-template-search' :
'visualeditor-dialog-transclusion-add-template';
addTemplateFieldsetConfig = ve.extendObject( addTemplateFieldsetConfig, {
label: ve.msg( 'visualeditor-dialog-transclusion-template-search' ),
// The following messages are used here:
// * visualeditor-dialog-transclusion-template-search
// * visualeditor-dialog-transclusion-add-template
label: ve.msg( dialogTitle ),
help: ve.msg( 'visualeditor-dialog-transclusion-template-search-help' ),
helpInline: true
} );
@ -109,18 +116,21 @@ ve.ui.MWTemplatePlaceholderPage.prototype.setOutlineItem = function () {
// Parent method
ve.ui.MWTemplatePlaceholderPage.super.prototype.setOutlineItem.apply( this, arguments );
var dialogTitle = ( this.placeholder.getTransclusion().parts.length === 1 &&
mw.config.get( 'wgVisualEditorConfig' ).templateSearchImprovements ) ?
'visualeditor-dialog-transclusion-template-search' :
'visualeditor-dialog-transclusion-add-template';
if ( this.outlineItem ) {
this.outlineItem
.setIcon( 'puzzle' )
.setMovable( true )
.setRemovable( true )
.setFlags( [ 'placeholder' ] )
.setLabel( ve.msg(
// Temporary switch for verbose template search.
mw.config.get( 'wgVisualEditorConfig' ).templateSearchImprovements ?
'visualeditor-dialog-transclusion-template-search' :
'visualeditor-dialog-transclusion-placeholder'
) );
// The following messages are used here:
// * visualeditor-dialog-transclusion-template-search
// * visualeditor-dialog-transclusion-add-template
.setLabel( ve.msg( dialogTitle ) );
}
};