r98945 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98944‎ | r98945 | r98946 >
Date:22:38, 4 October 2011
Author:krinkle
Status:ok
Tags:
Comment:
[RL2] Use variable name instead of literal -1 for clarity
* Also fetching from wgNamespaceIds instead and moving an existing reference to a namesake id higher up in the scope to expose it in the entire module.
(Follows-up r98735)
Modified paths:
  • /branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.js
@@ -93,7 +93,9 @@
9494 /**
9595 * @var {Number} Maximum number of autocomplete suggestions in the gadget editor input fields.
9696 */
97 - suggestLimit = 7;
 97+ suggestLimit = 7,
 98+ nsGadgetId = mw.config.get( 'wgNamespaceIds' ).gadget,
 99+ nsSpecialId = mw.config.get( 'wgNamespaceIds' ).special;
98100
99101 /* Local functions */
100102
@@ -178,11 +180,11 @@
179181 ga.ui.startGadgetManager( id );
180182 return;
181183 }
182 - // Use localized page name if possible to avoid redirect
 184+ // Use localized special page name if possible to avoid redirect
183185 if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Gadgets' ) {
184 - t = new mw.Title( mw.config.get( 'wgTitle' ) + '/' + id, -1 );
 186+ t = new mw.Title( mw.config.get( 'wgTitle' ) + '/' + id, nsSpecialId );
185187 } else {
186 - t = new mw.Title( 'Gadgets/' + id, -1 );
 188+ t = new mw.Title( 'Gadgets/' + id, nsSpecialId );
187189 }
188190 window.location.href = t.getUrl();
189191
@@ -344,8 +346,7 @@
345347 * @return {jQuery} The form.
346348 */
347349 getFancyForm: function( gadget, categories, mode ) {
348 - var nsGadgetId = mw.config.get( 'wgNamespaceIds' ).gadget,
349 - metadata = gadget.metadata,
 350+ var metadata = gadget.metadata,
350351 $form = $( tpl.fancyForm ).localize(),
351352 $idSpan = $form.find( '.mw-gadgetmanager-id' ),
352353 $idErrMsg = $form.find( '.mw-gadgetmanager-id-errorbox' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98735[RL2] Entire gadget row is now clickablekrinkle02:41, 3 October 2011

Status & tagging log