Add message on multipart content

Bug: T276574
Change-Id: Iff5c2fd4071dd03ca62c395cce4041dacb1c7ea6
This commit is contained in:
WMDE-Fisch 2021-08-23 13:25:15 +02:00 committed by Adam Wight
parent d37304abce
commit 67988452ab
5 changed files with 17 additions and 1 deletions

View file

@ -2212,6 +2212,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter-description",
"visualeditor-dialog-transclusion-loading",
"visualeditor-dialog-transclusion-more-template-description",
"visualeditor-dialog-transclusion-multipart-message",
"visualeditor-dialog-transclusion-no-template-description",
"visualeditor-dialog-transclusion-absent-template",
"visualeditor-dialog-transclusion-options",

View file

@ -185,6 +185,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter-description": "Field is deprecated. $1",
"visualeditor-dialog-transclusion-loading": "Loading...",
"visualeditor-dialog-transclusion-more-template-description": "There might be some additional information about the \"$1\" template on [[{{ns:template}}:$1|its page]].",
"visualeditor-dialog-transclusion-multipart-message": "You are currently editing a template and one or more pieces of connected content (wikitext and/or additional templates).",
"visualeditor-dialog-transclusion-no-template-description": "The \"$1\" template doesn't yet have a description, but there might be some information on the [[$1|template's page]].",
"visualeditor-dialog-transclusion-options": "Options",
"visualeditor-dialog-transclusion-param-default": "Default: $1",

View file

@ -203,6 +203,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter-description": "Label describing that a parameter is deprecated.\n\nParameters:\n* $1 - Description given in TemplateData for why parameter is deprecated, which may be empty.",
"visualeditor-dialog-transclusion-loading": "Title for the transclusion dialog while its contents are loading.\n{{Identical|Loading}}",
"visualeditor-dialog-transclusion-more-template-description": "Message to user that additional template information might be available for a template.\n\nParameters:\n* $1 - the title of the template",
"visualeditor-dialog-transclusion-multipart-message": "Message displayed when a transclusion with multiple parts is edited.",
"visualeditor-dialog-transclusion-no-template-description": "Message to user that no template information is available for the template.\n\nParameters:\n* $1 - the title of the template",
"visualeditor-dialog-transclusion-options": "Label for section with options for templates, content or parameters.\n{{Identical|Options}}",
"visualeditor-dialog-transclusion-param-default": "Label for parameter's default value in the template dialog. $1 - Parameter's default value.\n{{Identical|Default}}",

View file

@ -238,12 +238,15 @@ ve.ui.MWTransclusionDialog.prototype.onBookletLayoutSet = function ( page ) {
*/
ve.ui.MWTransclusionDialog.prototype.onReplacePart = function ( removed, added ) {
ve.ui.MWTransclusionDialog.super.prototype.onReplacePart.call( this, removed, added );
var parts = this.transclusionModel.getParts();
if ( this.transclusionModel.getParts().length === 0 ) {
if ( parts.length === 0 ) {
this.addParameterButton.setDisabled( true );
this.addPart( new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel ) );
}
this.multipartMessage.toggle( parts.length > 1 && this.useNewSidebar );
var canCollapse = this.isSingleTemplateTransclusion();
this.actions.setAbilities( { mode: canCollapse } );
this.updateActionSet();
@ -527,6 +530,11 @@ ve.ui.MWTransclusionDialog.prototype.initialize = function () {
this.bookletLayout.getOutlineControls().addItems( [ this.addParameterButton ] );
}
this.multipartMessage = new OO.ui.MessageWidget( {
label: ve.msg( 'visualeditor-dialog-transclusion-multipart-message' ),
classes: [ 've-ui-mwTransclusionDialog-multipart-message' ]
} );
// Events
if ( this.useInlineDescriptions ) {
this.getManager().connect( this, { resize: ve.debounce( this.onWindowResize.bind( this ) ) } );
@ -543,6 +551,7 @@ ve.ui.MWTransclusionDialog.prototype.initialize = function () {
} );
if ( this.useNewSidebar ) {
this.bookletLayout.$element.on( 'focusin', this.onBookletLayoutFocus.bind( this ) );
this.bookletLayout.stackLayout.$element.prepend( this.multipartMessage.$element );
}
};

View file

@ -205,3 +205,7 @@
color: #72777d;
margin: 8px 24px;
}
.ve-ui-mwTransclusionDialog-multipart-message {
margin: 20px;
}