r112963 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112962‎ | r112963 | r112964 >
Date:21:32, 3 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r112961; selecting an item with return should not submit dialog
Modified paths:
  • /trunk/extensions/EducationProgram/resources/ep.enlist.js (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/resources/ep.enlist.js
@@ -137,7 +137,8 @@
138138
139139 this.doAdd = function() {
140140 var $add = $( '#ep-' + role + '-add-button' ),
141 - $cancel = $( '#ep-' + role + '-add-cancel-button' );
 141+ $cancel = $( '#ep-' + role + '-add-cancel-button' ),
 142+ isCompletionEnter = false;
142143
143144 $add.button( 'option', 'disabled', true );
144145 $add.button( 'option', 'label', ep.msg( 'ep-' + role + '-adding' ) );
@@ -244,6 +245,11 @@
245246 },
246247 close: function() {
247248 $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
 249+ },
 250+ select: function( event, ui ) {
 251+ if ( ( event.keyCode ? event.keyCode : event.which ) === 13 ) {
 252+ isCompletionEnter = true;
 253+ }
248254 }
249255 } );
250256 }
@@ -260,7 +266,13 @@
261267 var enterHandler = function( event ) {
262268 if ( event.which == '13' ) {
263269 event.preventDefault();
264 - _this.doAdd();
 270+
 271+ if ( isCompletionEnter ) {
 272+ isCompletionEnter = false;
 273+ }
 274+ else {
 275+ _this.doAdd();
 276+ }
265277 }
266278 };
267279

Follow-up revisions

RevisionCommit summaryAuthorDate
r112965Follow up to r112963; fix var definition and improved error handlingjeroendedauw21:54, 3 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112961added name autocompletion to enlistment dialogjeroendedauw20:34, 3 March 2012

Status & tagging log