jenkins-bot has submitted this change and it was merged.

Change subject: MWTitleInputWidget: Remove prefixColon option and use relative 
title instead
......................................................................


MWTitleInputWidget: Remove prefixColon option and use relative title instead

See Ie554adef which implements this as a method on mw.Title instead.

Bug: 67386
Change-Id: I0d768fac338aed04fd2c0e4e8da8d556f94a4287
---
M modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
M modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js
2 files changed, 9 insertions(+), 8 deletions(-)

Approvals:
  Trevor Parscal: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js 
b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
index 0a2e775..0fab8e0 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
@@ -29,7 +29,7 @@
        this.placeholder = placeholder;
 
        this.addTemplateInput = new ve.ui.MWTitleInputWidget( {
-               '$': this.$, '$overlay': this.$overlay, 'namespace': 10, 
'prefixColon': true
+               '$': this.$, '$overlay': this.$overlay, 'namespace': 10
        } )
                .connect( this, {
                        'change': 'onTemplateInputChange',
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js
index 395d8ff..c199577 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js
@@ -17,9 +17,6 @@
  * @constructor
  * @param {Object} [config] Configuration options
  * @cfg {number} [namespace] Namespace to prepend to queries
- * @cfg {boolean} [prefixColon=false] Whether or not to prefix entries outside 
the
- *  target namespace (if set) with a colon. Assumed to be true unless
- *  explicitly set to false.
  */
 ve.ui.MWTitleInputWidget = function VeUiMWTitleInputWidget( config ) {
        // Config intialization
@@ -33,7 +30,6 @@
 
        // Properties
        this.namespace = config.namespace || null;
-       this.prefixColon = config.prefixColon === true;
 
        // Events
        this.lookupMenu.connect( this, { 'choose': 'onLookupMenuItemChoose' } );
@@ -115,9 +111,14 @@
        if ( matchingPages && matchingPages.length ) {
                for ( i = 0, len = matchingPages.length; i < len; i++ ) {
                        title = new mw.Title( matchingPages[i] );
-                       if ( this.namespace !== null && ( this.prefixColon || 
title.namespace === 0 ) ) {
-                               value = title.getNamespaceId() === 
this.namespace ?
-                                       title.getMainText() : ':' + 
title.getPrefixedText();
+                       if ( this.namespace !== null ) {
+                               if ( title.getNamespaceId() === this.namespace 
) {
+                                       value = title.getMainText();
+                               } else if ( title.getNamespaceId() === 0 ) {
+                                       value = ':' + title.getPrefixedText();
+                               } else {
+                                       value = title.getPrefixedText();
+                               }
                        } else {
                                value = title.getPrefixedText();
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d768fac338aed04fd2c0e4e8da8d556f94a4287
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@wikimedia.org>
Gerrit-Reviewer: Trevor Parscal <tpars...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to