Display a message when no parameters are defined

If no parameters are defined in the TemplateData, have the table
display a specific message noting that.

Bug: T53429
Change-Id: I3c9ae31ef9eafab7f94325fcd58e14a3e45c9818
This commit is contained in:
Moriel Schottlender 2015-02-18 17:11:39 -08:00
parent ba0349866f
commit 4757a83f88
4 changed files with 15 additions and 0 deletions

View file

@ -105,6 +105,7 @@ $wgResourceModules['ext.templateDataGenerator.ui'] = array(
),
'messages' => array(
'comma-separator',
'templatedata-doc-no-params-set',
'templatedata-modal-button-add-language',
'templatedata-modal-button-addparam',
'templatedata-modal-button-apply',

View file

@ -688,6 +688,18 @@ class TemplateDataBlob {
. '</tr></thead>'
. '<tbody>';
if ( count( (array)$data->params ) === 0 ) {
// Display no parameters message
$html .= '<tr>'
. Html::element( 'td',
array(
'class' => 'mw-templatedata-doc-muted',
'colspan' => 7
),
wfMessage( 'templatedata-doc-no-params-set' )->inLanguage( $lang )->text()
)
. '</tr>';
}
foreach ( $data->paramOrder as $paramName ) {
$paramObj = $data->params->$paramName;
$description = '';

View file

@ -11,6 +11,7 @@
"apihelp-templatedata-param-lang": "Return localized values in this language. By default all available translations are returned.",
"templatedata-desc": "Implement data storage for template parameters (using JSON)",
"templatedata-doc-desc-empty": "No description.",
"templatedata-doc-no-params-set": "No parameters specified",
"templatedata-doc-param-autovalue": "Auto value",
"templatedata-doc-param-autovalue-empty": "empty",
"templatedata-doc-param-default": "Default",

View file

@ -18,6 +18,7 @@
"apihelp-templatedata-param-lang": "{{doc-apihelp-param|templatedata|lang}}",
"templatedata-desc": "{{desc|name=Template Data|url=http://www.mediawiki.org/wiki/Extension:TemplateData}}",
"templatedata-doc-desc-empty": "Displayed when a template has no description (should be a valid sentence).\n{{Identical|No description}}",
"templatedata-doc-no-params-set": "A message shown when there are no parameters set in the TemplateData string.",
"templatedata-doc-param-autovalue": "Used as column heading in the table for auto fill value.\n{{Related|Templatedata-doc-param}}",
"templatedata-doc-param-autovalue-empty": "Displayed when a template parameter has no auto filled value (should not be a full sentence, used in a table).\n{{Identical|Empty}}",
"templatedata-doc-param-default": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Default}}",