r113708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113707‎ | r113708 | r113709 >
Date:05:08, 13 March 2012
Author:santhosh
Status:ok (Comments)
Tags:
Comment:
More cleanup of js, whitespaces.
ping r113631
Modified paths:
  • /trunk/extensions/Translate/resources/ext.translate.special.aggregategroups.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/resources/ext.translate.special.aggregategroups.js
@@ -1,6 +1,6 @@
22 jQuery( document ).ready( function ( $ ) {
33 "use strict";
4 -
 4+
55 function getApiParams( $target ) {
66 return {
77 action: 'aggregategroups',
@@ -17,8 +17,6 @@
1818 $selected = $( '#mw-tpa-groupselect-' + parentId + ' option:selected' ),
1919 subgroupId = $selected.val(),
2020 subgroupName = $selected.text();
21 -
22 -
2321
2422 var successFunction = function( data, textStatus ) {
2523 if ( data.error ) {
@@ -45,7 +43,7 @@
4644 $span.click( dissociate );
4745 }
4846 };
49 -
 47+
5048 var params = $.extend( getApiParams( $target ), {
5149 'do' : 'associate',
5250 group: subgroupId,
@@ -64,7 +62,7 @@
6563 alert( data.error.info );
6664 } else {
6765 $( '<option>', { value: $target.data( 'groupid' ) } )
68 - .text( $target.parent( 'a' ).text() )
 66+ .text( $target.siblings( 'a' ).text() )
6967 .appendTo( $select );
7068 $target.parent( 'li' ).remove();
7169 }
@@ -91,7 +89,7 @@
9290 };
9391
9492 var params = $.extend( getApiParams( $target ), {'do' : 'remove' } );
95 - $.post( mw.util.wikiScript( "api" ), params, successFunction );
 93+ $.post( mw.util.wikiScript( 'api' ), params, successFunction );
9694 }
9795
9896 $( '.tp-aggregate-add-button' ).click( associate );
@@ -120,14 +118,14 @@
121119 .append ( $('<ol id=\'mw-tpa-grouplist-'+aggregateGroup+'\'>') );
122120
123121 if ( $select.length > 0 ){
124 - var $groupSelector = $( $( 'select.tp-aggregate-group-chooser')[0] ).clone();
 122+ var $groupSelector = $( $( 'select.tp-aggregate-group-chooser' )[0] ).clone();
125123 $groupSelector.attr('id', 'tp-aggregate-groups-select-' + aggregateGroup);
126 - var $addButton = $( $( 'input.tp-aggregate-add-button')[0]).clone();
 124+ var $addButton = $( $( 'input.tp-aggregate-add-button' )[0]).clone();
127125 $addButton.attr( 'id', aggregateGroup);
128126 $div.append( $groupSelector ).append( $addButton );
129 - $addButton.on ( "click", function( event ){ associate(event); } );
130 - $removeSpan.on ( "click", function( event ){ removeGroup(event); } );
131 - $( 'div.tpt-add-new-group' ).addClass('hidden');
 127+ $addButton.click( associate );
 128+ $removeSpan.click( removeGroup );
 129+ $( 'div.tpt-add-new-group' ).addClass( 'hidden' );
132130 }else{
133131 // First group in the wiki. Cannot clone the group selector, just reload this time.
134132 location.reload();
@@ -145,6 +143,6 @@
146144 groupdescription: aggregateGroupDesc,
147145 format: "json"
148146 };
149 - $.post( mw.util.wikiScript( "api" ), params, successFunction );
 147+ $.post( mw.util.wikiScript( 'api' ), params, successFunction );
150148 } )
151149 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113631Committing my unfinished cleanups - should still be fully functional....nikerabbit16:57, 12 March 2012

Comments

#Comment by Krinkle (talk | contribs)   05:10, 13 March 2012
-					.text( $target.parent( 'a' ).text() )
+					.text( $target.siblings( 'a' ).text() )

This non-trivial change wasn't described in the commit-msg, was this committed intentional? If so, please explain what bug it is supposed to fix.

#Comment by Santhosh.thottingal (talk | contribs)   05:14, 13 March 2012

the $target here is span, which does not have a parent 'a', but it is sibling of span. Fixes broken dissociate button in r113631. Sorry to add that in commit message

#Comment by Nikerabbit (talk | contribs)   07:29, 13 March 2012

Yep you fixed a bug I introduced, thanks.

Status & tagging log