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

Change subject: Display the absence of any requests as a header
......................................................................


Display the absence of any requests as a header

Move all the request counter updating to front end.
Update tests and remove irrelevant steps.

Change-Id: I47f98f9a27ef28d822d50ef95a28310438a45943
---
M resources/js/ext.translate.special.managetranslatorsandbox.js
M specials/SpecialManageTranslatorSandbox.php
M tests/browser/features/manage_translator_sandbox.feature
M tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
4 files changed, 21 insertions(+), 15 deletions(-)

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



diff --git a/resources/js/ext.translate.special.managetranslatorsandbox.js 
b/resources/js/ext.translate.special.managetranslatorsandbox.js
index 4c90fd4..5c3aad2 100644
--- a/resources/js/ext.translate.special.managetranslatorsandbox.js
+++ b/resources/js/ext.translate.special.managetranslatorsandbox.js
@@ -313,8 +313,22 @@
         * Updates the number of requests.
         */
        function updateRequestCount() {
-               $( '.request-count' )
-                       .text( mw.msg( 'tsb-request-count', $( 
'.request:not(.hide)' ).length ) );
+               var $requests = $( '.requests-list .request' ),
+                       visibleRequestsCount = $requests.filter( ':not(.hide)' 
).length;
+
+               $( '.request-count' ).text(
+                       mw.msg( 'tsb-request-count', mw.language.convertNumber( 
visibleRequestsCount ) )
+               );
+
+               if ( $requests.length === 0 ) {
+                       $( '.details.pane' )
+                               .empty()
+                               .append(
+                                       $( '<div>' )
+                                               .addClass( 'tsb-header row' )
+                                               .text( mw.msg( 
'tsb-no-requests-from-new-users' ) )
+                               );
+               }
        }
 
        /**
@@ -485,8 +499,7 @@
        $( document ).ready( function () {
                var $requestCheckboxes = $( '.request-selector' ),
                        $selectAll = $( '.request-selector-all' ),
-                       $requestRows = $( '.requests .request' ),
-                       $detailsPane = $( '.details.pane' );
+                       $requestRows = $( '.requests .request' );
 
                // Delay so we get the correct height on page load
                window.setTimeout( setPanesHeight, 0 );
@@ -505,9 +518,9 @@
 
                if ( $requestRows.length ) {
                        $requestRows.first().click();
-               } else {
-                       $detailsPane.text( mw.msg( 
'tsb-no-requests-from-new-users' ) );
                }
+
+               updateRequestCount();
        } );
 
        // ======================================
diff --git a/specials/SpecialManageTranslatorSandbox.php 
b/specials/SpecialManageTranslatorSandbox.php
index 4692ff5..83eb934 100644
--- a/specials/SpecialManageTranslatorSandbox.php
+++ b/specials/SpecialManageTranslatorSandbox.php
@@ -211,7 +211,6 @@
                // Sort the requests based on translations and registration date
                usort( $requests, array( __CLASS__, 'translatorRequestSort' ) );
 
-               $count = count( $requests );
                foreach ( $requests as $request ) {
                        $items[] = $this->makeRequestItem( $request );
                }
@@ -225,9 +224,7 @@
                        {$this->msg( "tsb-all-languages-button-label" 
)->escaped()}
                </button>
        </div>
-       <div class="five columns request-count">
-               {$this->msg( "tsb-request-count" )->numParams( $count 
)->parse()}
-       </div>
+       <div class="five columns request-count"></div>
        <div class="three columns center">
                <input class="request-selector-all" name="request" 
type="checkbox" />
        </div>
diff --git a/tests/browser/features/manage_translator_sandbox.feature 
b/tests/browser/features/manage_translator_sandbox.feature
index 89f7598..1a35ef2 100644
--- a/tests/browser/features/manage_translator_sandbox.feature
+++ b/tests/browser/features/manage_translator_sandbox.feature
@@ -18,7 +18,7 @@
     Then no users are displayed in the first column
       And I should see "0 requests" at the top of the first column
       And I should see "0 users selected" at the bottom of the first column
-      And I should see "No requests from new users" in the second column
+      And I should see "No requests from new users" in the header of the 
second column
       And I should not see the older requests link at the bottom of the first 
column
 
   Scenario: Existing users can be searched on the list
diff --git 
a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb 
b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
index c01e402..3caade9 100644
--- a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
+++ b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
@@ -136,10 +136,6 @@
        on(ManageTranslatorSandboxPage).request_count.should == text
 end
 
-Then(/^I should see "(.*)" in the second column$/) do |text|
-       on(ManageTranslatorSandboxPage).details.should == text
-end
-
 Then(/^I should see the button that clears language selection$/) do
        on(ManageTranslatorSandboxPage).clear_language_selector_element.should 
be_visible
 end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I47f98f9a27ef28d822d50ef95a28310438a45943
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to