mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
MWTemplateDialog: When opening the dialog, add in any unset suggested and required parameters
Bug: T97482 Change-Id: Iaf280355f442240aba4e1f74d3ee402fc5d329b0
This commit is contained in:
parent
953422a605
commit
832118e051
|
@ -288,10 +288,7 @@ ve.dm.MWTemplateModel.prototype.removeParameter = function ( param ) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Add all non-existing required and suggested parameters, if any.
|
||||
*
|
||||
* @method
|
||||
* @return {number} Number of parameters added
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.dm.MWTemplateModel.prototype.addPromptedParameters = function () {
|
||||
var i, len, addedCount = 0,
|
||||
|
|
|
@ -542,4 +542,14 @@
|
|||
return -1;
|
||||
};
|
||||
|
||||
/*
|
||||
* Add missing required and suggested parameters to each transclusion.
|
||||
*/
|
||||
ve.dm.MWTransclusionModel.prototype.addPromptedParameters = function () {
|
||||
var i;
|
||||
for ( i = 0; i < this.parts.length; i++ ) {
|
||||
this.parts[ i ].addPromptedParameters();
|
||||
}
|
||||
};
|
||||
|
||||
}() );
|
||||
|
|
|
@ -77,3 +77,13 @@ ve.dm.MWTransclusionPartModel.prototype.serialize = function () {
|
|||
ve.dm.MWTransclusionPartModel.prototype.getWikitext = function () {
|
||||
return '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Add all non-existing required and suggested parameters, if any.
|
||||
*
|
||||
* @method
|
||||
* @return {number} Number of parameters added
|
||||
*/
|
||||
ve.dm.MWTransclusionPartModel.prototype.addPromptedParameters = function () {
|
||||
return 0;
|
||||
};
|
||||
|
|
|
@ -78,6 +78,8 @@ ve.ui.MWTemplateDialog.static.bookletLayoutConfig = {
|
|||
* Handle the transclusion being ready to use.
|
||||
*/
|
||||
ve.ui.MWTemplateDialog.prototype.onTransclusionReady = function () {
|
||||
// Add missing required and suggested parameters to each transclusion.
|
||||
this.transclusionModel.addPromptedParameters();
|
||||
this.loaded = true;
|
||||
this.$element.addClass( 've-ui-mwTemplateDialog-ready' );
|
||||
this.$body.append( this.bookletLayout.$element );
|
||||
|
|
Loading…
Reference in a new issue