Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237153

Change subject: Show suggestions in the dashboard only if enabled
......................................................................

Show suggestions in the dashboard only if enabled

Uses the variable $wgContentTranslationEnableSuggestions,
which was introduced in
I62b168957c4a9e2d0518fdbb48d6ceec44bf5dbd

Bug: T111960
Change-Id: I02eb423eb92c570d4f38aee8107f10153e1fa7fb
---
M ContentTranslation.hooks.php
M modules/dashboard/ext.cx.dashboard.js
2 files changed, 17 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/53/237153/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 8182cdd..c910ef2 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -164,6 +164,7 @@
        public static function addConfig( array &$vars ) {
                global $wgContentTranslationTranslateInTarget,
                        $wgContentTranslationDomainCodeMapping,
+                       $wgContentTranslationEnableSuggestions,
                        $wgContentTranslationExperimentalFeatures,
                        $wgContentTranslationDatabase,
                        $wgContentTranslationSiteTemplates,
@@ -174,6 +175,7 @@
 
                $vars['wgContentTranslationTranslateInTarget'] = 
$wgContentTranslationTranslateInTarget;
                $vars['wgContentTranslationDomainCodeMapping'] = 
$wgContentTranslationDomainCodeMapping;
+               $vars['wgContentTranslationEnableSuggestions'] = 
$wgContentTranslationEnableSuggestions;
                $vars['wgContentTranslationExperimentalFeatures'] = 
$wgContentTranslationExperimentalFeatures;
                $vars['wgContentTranslationDatabase'] = 
$wgContentTranslationDatabase;
                $vars['wgContentTranslationSiteTemplates'] = 
$wgContentTranslationSiteTemplates;
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 13d6f87..2b34282 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -170,19 +170,23 @@
        };
 
        CXDashboard.prototype.buildTranslationList = function () {
-               var $sourceLanguageContainer, $filterTabs, 
$targetLanguageContainer;
+               var $sourceLanguageContainer, $targetLanguageContainer,
+                       $filterTabs = [];
 
-               $filterTabs = [
-                       $( '<span>' )
+               if ( mw.config.get( 'wgContentTranslationEnableSuggestions' ) ) 
{
+                       $filterTabs.push( $( '<span>' )
                                .addClass( 'cx-filter cx-suggestions 
mw-ui-input' )
-                               .text( mw.msg( 
'cx-translation-filter-suggested-translations' ) ),
-                       $( '<span>' )
-                               .addClass( 'cx-filter cx-filter--draft 
cx-filter--selected mw-ui-input' )
-                               .text( mw.msg( 
'cx-translation-filter-draft-translations' ) ),
-                       $( '<span>' )
-                               .addClass( 'cx-filter cx-filter--published 
mw-ui-input' )
-                               .text( mw.msg( 
'cx-translation-filter-published-translations' ) )
-               ];
+                               .text( mw.msg( 
'cx-translation-filter-suggested-translations' ) ) );
+               }
+
+               $filterTabs.push( $( '<span>' )
+                       .addClass( 'cx-filter cx-suggestions mw-ui-input' )
+                       .text( mw.msg( 
'cx-translation-filter-draft-translations' ) ) );
+
+               $filterTabs.push( $( '<span>' )
+                       .addClass( 'cx-filter cx-filter--published mw-ui-input' 
)
+                       .text( mw.msg( 
'cx-translation-filter-published-translations' ) ) );
+
                this.$listHeader = $( '<div>' ).addClass( 'translation-filter' 
);
                this.$newTranslationButton = $( '<button>' )
                        .addClass( 'cx-cta__new-translation mw-ui-button 
mw-ui-constructive' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02eb423eb92c570d4f38aee8107f10153e1fa7fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to