MWTemplatePage: Show a link to the template even when there's a description

Bug: T51772
Change-Id: Ia7084dc7dd4e4c092c0d24b123da19721dca54a9
This commit is contained in:
James D. Forrester 2015-12-07 13:55:59 -08:00 committed by Ed Sanders
parent 4a1cd55503
commit d576fac49f
5 changed files with 16 additions and 5 deletions

View file

@ -1678,6 +1678,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter", "visualeditor-dialog-transclusion-deprecated-parameter",
"visualeditor-dialog-transclusion-deprecated-parameter-description", "visualeditor-dialog-transclusion-deprecated-parameter-description",
"visualeditor-dialog-transclusion-loading", "visualeditor-dialog-transclusion-loading",
"visualeditor-dialog-transclusion-more-template-description",
"visualeditor-dialog-transclusion-multiple-mode", "visualeditor-dialog-transclusion-multiple-mode",
"visualeditor-dialog-transclusion-no-template-description", "visualeditor-dialog-transclusion-no-template-description",
"visualeditor-dialog-transclusion-options", "visualeditor-dialog-transclusion-options",

View file

@ -200,6 +200,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter": "Deprecated field", "visualeditor-dialog-transclusion-deprecated-parameter": "Deprecated field",
"visualeditor-dialog-transclusion-deprecated-parameter-description": "Field is deprecated. $1", "visualeditor-dialog-transclusion-deprecated-parameter-description": "Field is deprecated. $1",
"visualeditor-dialog-transclusion-loading": "Loading...", "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-multiple-mode": "Show options", "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-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-options": "Options",

View file

@ -213,6 +213,7 @@
"visualeditor-dialog-transclusion-deprecated-parameter": "Tooltip for deprecated parameter indicator", "visualeditor-dialog-transclusion-deprecated-parameter": "Tooltip for deprecated parameter indicator",
"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-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-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-multiple-mode": "Label for button that shows advanced options in transclusion dialog", "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-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-options": "Label for section with options for templates, content or parameters.\n{{Identical|Options}}",

View file

@ -17,7 +17,7 @@
* @param {Object} [config] Configuration options * @param {Object} [config] Configuration options
*/ */
ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) { ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
var title; var title = template.getTitle() ? mw.Title.newFromText( template.getTitle() ) : null;
// Configuration initialization // Configuration initialization
config = ve.extendObject( { config = ve.extendObject( {
@ -56,14 +56,21 @@ ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
this.$description.addClass( 've-ui-mwTemplatePage-description' ); this.$description.addClass( 've-ui-mwTemplatePage-description' );
if ( this.spec.getDescription() ) { if ( this.spec.getDescription() ) {
this.$description.text( this.spec.getDescription() ); this.$description.text( this.spec.getDescription() );
if ( title ) {
this.$description.append(
$( '<hr>' ),
$( '<span>' )
.addClass( 've-ui-mwTemplatePage-description-extra' )
.html( mw.message(
'visualeditor-dialog-transclusion-more-template-description',
title.getRelativeText( mw.config.get( 'wgNamespaceIds' ).template )
).parse() )
);
}
} else { } else {
title = this.template.getTitle();
// The transcluded page may be dynamically generated or unspecified in the DOM // 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 // 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. // the template is called nor link to the template page.
if ( title ) {
title = mw.Title.newFromText( title );
}
if ( title ) { if ( title ) {
this.$description this.$description
.addClass( 've-ui-mwTemplatePage-description-missing' ) .addClass( 've-ui-mwTemplatePage-description-missing' )

View file

@ -18,6 +18,7 @@
color: #555; color: #555;
} }
.ve-ui-mwTemplatePage-description-extra,
.ve-ui-mwTemplatePage-description-missing { .ve-ui-mwTemplatePage-description-missing {
font-style: italic; font-style: italic;
} }