jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/349370 )
Change subject: MWTemplatePage: Show a different message if the template
doesn't exist
......................................................................
MWTemplatePage: Show a different message if the template doesn't exist
Bug: T162694
Change-Id: Icad5abb240efd10fadbfdb287acb98afe2361719
---
M extension.json
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
4 files changed, 14 insertions(+), 7 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extension.json b/extension.json
index e7d465e..f6a16ff 100644
--- a/extension.json
+++ b/extension.json
@@ -1709,6 +1709,7 @@
"visualeditor-dialog-transclusion-more-template-description",
"visualeditor-dialog-transclusion-multiple-mode",
"visualeditor-dialog-transclusion-no-template-description",
+
"visualeditor-dialog-transclusion-absent-template",
"visualeditor-dialog-transclusion-options",
"visualeditor-dialog-transclusion-param-default",
"visualeditor-dialog-transclusion-param-example",
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 6904ab8..5433bfd 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -208,6 +208,7 @@
"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-multiple-mode": "Show options",
"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-absent-template": "The \"$1\"
template doesn't yet exist.",
"visualeditor-dialog-transclusion-options": "Options",
"visualeditor-dialog-transclusion-param-default": "Default: $1",
"visualeditor-dialog-transclusion-param-example": "e.g. $1",
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index 9a76fc9..1c442c5 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -221,6 +221,7 @@
"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-multiple-mode": "Label for button
that shows advanced options in transclusion dialog",
"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-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-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}}",
"visualeditor-dialog-transclusion-param-example": "Label for
parameter's example value in the template dialog. $1 - Parameter's example
value.",
diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
index a0c11e0..571d519 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
@@ -17,7 +17,8 @@
* @param {Object} [config] Configuration options
*/
ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
- var title = template.getTitle() ? mw.Title.newFromText(
template.getTitle() ) : null;
+ var linkData, messageKey,
+ title = template.getTitle() ? mw.Title.newFromText(
template.getTitle() ) : null;
// Configuration initialization
config = ve.extendObject( {
@@ -71,15 +72,18 @@
}
} else {
// The transcluded page may be dynamically generated or
unspecified in the DOM
- // for other reasons (bug 66724). In that case we can't tell
the user what
- // the template is called nor link to the template page.
+ // for other reasons (T68724). In that case we can't tell the
user what the
+ // template is called, nor link to the template page. However,
if we know for
+ // certain that the template doesn't exist, be explicit about
it (T162694).
if ( title ) {
+ linkData = ve.init.platform.linkCache.getCached(
'_missing/' + title );
+ messageKey = linkData && linkData.missing ?
+
'visualeditor-dialog-transclusion-absent-template' :
+
'visualeditor-dialog-transclusion-no-template-description';
+
this.$description
.addClass(
've-ui-mwTemplatePage-description-missing' )
- .append( mw.message(
-
'visualeditor-dialog-transclusion-no-template-description',
- title.getPrefixedText()
- ).parseDom() )
+ .append( mw.message( messageKey,
title.getPrefixedText() ).parseDom() )
.find( 'a' ).attr( 'target', '_blank' );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/349370
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icad5abb240efd10fadbfdb287acb98afe2361719
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits