Trevor Parscal has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/111389

Change subject: [WIP] Auto-select first auto-added required param and fix param 
order
......................................................................

[WIP] Auto-select first auto-added required param and fix param order

This is good to go, except I don't actually understand why adding -1 is needed, 
and until I do, I feel like it might just be masking a larger problem.

Change-Id: I299053b63045ec933747831f1b4aa63493760f8b
---
M modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/89/111389/1

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
index a4ba58a..1089034 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
@@ -75,7 +75,7 @@
                        page = new ve.ui.MWTemplatePlaceholderPage( added, 
added.getId(), { '$': this.$ } );
                }
                if ( page ) {
-                       this.bookletLayout.addPages( [ page ], 
this.transclusion.getIndex( added ) );
+                       this.bookletLayout.addPages( [ page ], 
this.transclusion.getIndex( added ) - 1 );
                        if ( select && this.loaded ) {
                                this.setPageByName( added.getId() );
                        }
@@ -92,6 +92,11 @@
                        // Add required params to user created templates
                        if ( added instanceof ve.dm.MWTemplateModel && 
this.loaded ) {
                                added.addRequiredParameters();
+                               names = added.getParameterNames();
+                               params = added.getParameters();
+                               if ( names.length ) {
+                                       this.setPageByName( 
params[names[0]].getId() );
+                               }
                        }
                }
        }
@@ -104,7 +109,7 @@
  */
 ve.ui.MWTransclusionDialog.prototype.onAddParameter = function ( param ) {
        var page = new ve.ui.MWTemplateParameterPage( param, param.getId(), { 
'$': this.$ } );
-       this.bookletLayout.addPages( [ page ], this.transclusion.getIndex( 
param ) );
+       this.bookletLayout.addPages( [ page ], this.transclusion.getIndex( 
param ) - 1 );
        if ( this.loaded ) {
                this.setPageByName( param.getId() );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/111389
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I299053b63045ec933747831f1b4aa63493760f8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to