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

Change subject: Hide the group selector after click on the group.
......................................................................


Hide the group selector after click on the group.

Used option preventSelector to allow loading the selector
without reopening the group selector on clicking the group.

Bug: T106319
Change-Id: I2166977f7717c8a8aeb8deb966481fbf844b0ada
---
M resources/js/ext.translate.groupselector.js
M resources/js/ext.translate.special.searchtranslations.js
2 files changed, 17 insertions(+), 13 deletions(-)

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



diff --git a/resources/js/ext.translate.groupselector.js 
b/resources/js/ext.translate.groupselector.js
index 2415ae5..e9f35c7 100644
--- a/resources/js/ext.translate.groupselector.js
+++ b/resources/js/ext.translate.groupselector.js
@@ -8,6 +8,7 @@
         *  - position: accepts same values as jquery.ui.position
         *  - onSelect: callback with message group id when selected
         *  - language: language for statistics.
+        *  - preventSelector: boolean to load but not show the group selector.
         * groups: list of message group ids
         */
        function TranslateMessageGroupSelector( element, options, groups ) {
@@ -189,19 +190,21 @@
                                // this will fail.
                                $( '.tux-breadcrumb .tail' ).remove();
 
-                               $newLink = $( '<span>' )
-                                       .addClass( 'grouptitle grouplink tail' )
-                                       .text( messageGroup.label );
-                               $( '.tux-breadcrumb .grouplink:last' ).after( 
$newLink );
-                               $newLink.data( 'msggroupid', messageGroup.id );
+                               if ( !groupSelector.options.preventSelector ) {
+                                       $newLink = $( '<span>' )
+                                               .addClass( 'grouptitle 
grouplink tail' )
+                                               .text( messageGroup.label );
+                                       $( '.tux-breadcrumb .grouplink:last' 
).after( $newLink );
+                                       $newLink.data( 'msggroupid', 
messageGroup.id );
 
-                               if ( messageGroup.groups && 
messageGroup.groups.length > 0 ) {
-                                       // Pass options for callbacks, language 
etc. but ignore the position
-                                       // option unless explicitly given to 
allow automatic recalculation
-                                       // of the position compared to the new 
trigger.
-                                       $newLink.msggroupselector( 
groupSelector.customOptions );
-                                       // Show the new menu immediately
-                                       $newLink.data( 'msggroupselector' 
).show();
+                                       if ( messageGroup.groups && 
messageGroup.groups.length > 0 ) {
+                                               // Pass options for callbacks, 
language etc. but ignore the position
+                                               // option unless explicitly 
given to allow automatic recalculation
+                                               // of the position compared to 
the new trigger.
+                                               $newLink.msggroupselector( 
groupSelector.customOptions );
+                                               // Show the new menu immediately
+                                               $newLink.data( 
'msggroupselector' ).show();
+                                       }
                                }
 
                                if ( groupSelector.options.onSelect ) {
diff --git a/resources/js/ext.translate.special.searchtranslations.js 
b/resources/js/ext.translate.special.searchtranslations.js
index dc93841..92536f7 100644
--- a/resources/js/ext.translate.special.searchtranslations.js
+++ b/resources/js/ext.translate.special.searchtranslations.js
@@ -310,7 +310,8 @@
                                        var uri = new mw.Uri( location.href );
                                        uri.extend( { group: group.id, 
grouppath: group.id } );
                                        location.href = uri.toString();
-                               }
+                               },
+                               preventSelector: true
                        };
                        groups = $.map( resultGroups, function ( value, index ) 
{
                                return index;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2166977f7717c8a8aeb8deb966481fbf844b0ada
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Phoenix303 <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Phoenix303 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to