Improve messaging for when a template is not found

Bug: T290140
Change-Id: Ie43c7e2bd72ed92a8a336f6d87a54e6d51cc3f17
This commit is contained in:
Andrew Kostka 2021-09-17 13:12:53 +02:00
parent 3b917f0c16
commit 7165efd491
4 changed files with 29 additions and 4 deletions

View file

@ -2227,6 +2227,9 @@
"visualeditor-dialog-transclusion-no-template-data-description",
"visualeditor-dialog-transclusion-no-template-description",
"visualeditor-dialog-transclusion-absent-template",
"visualeditor-dialog-transclusion-template-title-nonexistent",
"visualeditor-dialog-transclusion-template-title-modifier",
"visualeditor-dialog-transclusion-template-title-invalid",
"visualeditor-dialog-transclusion-options",
"visualeditor-dialog-transclusion-param-default",
"visualeditor-dialog-transclusion-param-example",

View file

@ -171,6 +171,9 @@
"visualeditor-dialog-template-title": "Template",
"visualeditor-dialog-transclusion-action-save": "Save",
"visualeditor-dialog-transclusion-absent-template": "The \"$1\" template doesn't yet exist.",
"visualeditor-dialog-transclusion-template-title-nonexistent": "This template doesn't exist.",
"visualeditor-dialog-transclusion-template-title-modifier": "Template documentation and [//www.mediawiki.org/wiki/Manual:Glossary#Parameter parameter] names (if existing) are not available when editing templates using modifiers, such as [//www.mediawiki.org/wiki/Help:Substitution subst].",
"visualeditor-dialog-transclusion-template-title-invalid": "This template can not exist since its name is invalid.",
"visualeditor-dialog-transclusion-add-content": "Add content",
"visualeditor-dialog-transclusion-add-wikitext": "Add wikitext",
"visualeditor-dialog-transclusion-add-param": "Add more information",

View file

@ -189,6 +189,9 @@
"visualeditor-dialog-template-title": "{{Identical|Template}}",
"visualeditor-dialog-transclusion-action-save": "Label for button that saves changes when editing an existing transclusion in the transclusion dialog.",
"visualeditor-dialog-transclusion-absent-template": "Message to user that the template they have selected does not exist on this wiki.\n\nParameters:\n* $1 - The title of the template.",
"visualeditor-dialog-transclusion-template-title-nonexistent": "Message to user that the template name they have provided does not exist on this wiki.",
"visualeditor-dialog-transclusion-template-title-modifier": "Message to user that the template name they have provided contains a modifier.",
"visualeditor-dialog-transclusion-template-title-invalid": "Message to user that the template name they have provided is invalid.",
"visualeditor-dialog-transclusion-add-content": "Label for button that adds parameter content to a transclusion.",
"visualeditor-dialog-transclusion-add-wikitext": "Label for button that adds parameter wikitext to a transclusion.",
"visualeditor-dialog-transclusion-add-param": "Label for button that adds a parameter to a transcluded template.",

View file

@ -67,12 +67,24 @@ ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
)
);
} else if ( pageMissing ) {
var msg,
templateLabel = this.spec.getLabel();
if ( veConfig.transclusionDialogNewSidebar ) {
msg = mw.message(
templateLabel.match( /:/ ) ?
'visualeditor-dialog-transclusion-template-title-modifier' :
'visualeditor-dialog-transclusion-template-title-nonexistent'
);
} else {
msg = mw.message(
'visualeditor-dialog-transclusion-absent-template',
templateLabel
);
}
this.$description
.addClass( 've-ui-mwTemplatePage-description-missing' )
.append( mw.message(
'visualeditor-dialog-transclusion-absent-template',
this.spec.getLabel()
).parseDom() );
.append( msg.parseDom() );
} else if ( !veConfig.transclusionDialogNewSidebar || this.spec.isDocumented() ) {
this.$description
.addClass( 've-ui-mwTemplatePage-description-missing' )
@ -82,6 +94,10 @@ ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
).parseDom() );
}
ve.targetLinksToNewWindow( this.$description[ 0 ] );
} else if ( veConfig.transclusionDialogNewSidebar ) {
this.$description
.addClass( 've-ui-mwTemplatePage-description-missing' )
.append( mw.message( 'visualeditor-dialog-transclusion-template-title-invalid' ).parseDom() );
}
this.$description.find( 'a[href]' )
.on( 'click', function () {